I am trying to make a spectate GUI for my PvP game, and I need to make sure people currently in the game cannot access the spectator mode. Spectating is activated by a button to the side, so I am trying to make that button invisible to players within the game. All players within the game are put on the "In Game" team. The entire spectate GUI, including the button that activates it, are stored in a Gui that is stored in the StarterGui. This is a local script within the button:
local tp = game.Teams:FindFirstChild('In Game'):GetPlayers()
while wait() do
if #tp > 0 then
script.Parent.Visible = false
else
script.Parent.Visible = true
end
end
I'm not entirely sure if I am doing this correctly at all, I'm kind of just grasping at straws, but that script doesn't make it invisible to players in the game. Anyone know how I could properly do this?
