Hello.
So I’m making a city game, and there’d be a leader that controls the city. He has the ability to raise taxes, but once the leader dies, he can’t change the taxes anymore. I made a script that does it, but for the first leader (the first person to join the server), when he dies, the tax button doesn’t go away, and it says in the player’s output:
Infinite yield possible on 'TownGui:WaitForChild("TaxGui")'
however it goes away for the other people, and it doesn’t even say that. I don’t even get what’s wrong.
Thanks for helping, here’s script:
local localplayer = game.Players.LocalPlayer
local playergui = localplayer:WaitForChild("PlayerGui"):WaitForChild("TownGui"):WaitForChild("TaxGui")
while true do
if localplayer.Team == game.Teams.Leader then
workspace.FoodPanel.SurfaceGui.Frame.Increase.Visible = true
playergui:WaitForChild("Increase").Visible = true
playergui:WaitForChild("Decrease").Visible = true
else
workspace.FoodPanel.SurfaceGui.Frame.Increase.Visible = false
playergui:WaitForChild("Increase").Visible = false
playergui:WaitForChild("Decrease").Visible = false
end
wait(0.01)
end