Highest y-level in the server gets glowing effect datapack help
Hi! i'm trying to make a datapack that makes it so that when a player has the heighest y level of anyone in the server, that player will get a (yellow) glowing effect. But when another player gets higher than the first player, the first player will lose the glowing effect and the other player gets it. As you can maybe guess im trying to make a sort of king of the hill minigame for me and my friends. I'm making this for a server on minehut.
I tried making the datapack with chatgpt (because i have no knowledge of datapack coding) and with the help of a tutorial and chatgpt i did get the glowing effect to work. But only downside is that everyone got the glowing effect. I want only the person who is the heighest to get the glowing effect. How can i do this?