Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Spectate Gui Adder, Crashes game?

Asked by 9 years ago

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

Answer this question