Ok so I have this script that at certain times it changes the spectate gui on your character so your able to see it and spectate if your on a certain team. Everytime I test it in studio it crashes the server... what did I do wrong?
Here is my script:
wait(1)
while true do
if game.Workspace.SpectateDisabled.Disabled == true then
for _, player in pairs(game.Players:GetChildren()) do
if player.TeamColor == BrickColor.new("Medium stone grey") then
wait(2)
player.PlayerGui.SpectateGui.Button.ImageTransparency = 1
wait(2)
end
if game.Workspace.SpectateDisabled.Disabled == false then
for _, player in pairs(game.Players:GetChildren()) do
if player.TeamColor == BrickColor.new("Medium stone grey") then
wait(2)
player.PlayerGui.SpectateGui.Button.ImageTransparency = 1
wait(2)
end
end
end
end
end
end
-And would this possibly work?
wait(1)
while true do
for _, player in pairs(game.Players:GetChildren()) do
if game.Workspace.SpectateDisabled.Disabled == true
and player.TeamColor == BrickColor.new("Medium stone grey") then
wait(2)
player.PlayerGui.SpectateGui.Button.ImageTransparency = 1
wait(2)
end
if game.Workspace.SpectateDisabled.Disabled == false
and player.TeamColor == BrickColor.new("Medium stone grey") then
wait(2)
player.PlayerGui.SpectateGui.Button.ImageTransparency = 1
wait(2)
end
end
end
