I tried making a round-based game that would edit each player's ScreenGui that had options to teleport around. It would cut it off for 60 seconds and cut it back on for 15 seconds.
while true do wait(15) local plrs = game.Players:GetChildren() for i = 1, #plrs do plrs[i].Character.HumanoidRootPart.CFrame = workspace.gameSpawn.CFrame plrs[i].PlayerGui.tps.Enabled = false end wait(60) local plrs = game.Players:GetChildren() for i = 1, #plrs do plrs[i].PlayerGui.tps.Enabled = true end end
It won't turn Enabled to true or false. Anyone know the reason why?
You need to add debounce:
local debounce = 0 while true do if debounce == 0 debounce = 1 wait(15) local plrs = game.Players:GetChildren() for i = 1, #plrs do plrs[i].Character.HumanoidRootPart.CFrame = workspace.gameSpawn.CFrame plrs[i].PlayerGui.tps.Enabled = false end wait(60) local plrs = game.Players:GetChildren() for i = 1, #plrs do plrs[i].PlayerGui.tps.Enabled = true end debounce = 0 end end