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

Why won't this shut down the server?

Asked by 8 years ago

As you know, the only way to shut down the server is to kick all of the players. That's my problem. It's not kicking everyone! How the script works, is that when a character dies, it make a value true and then kick everyone. Is there something wrong with this script?

while true do 
    wait(1)
    if game.Workspace:FindFirstChild("ISDEAD").Value == true then
                for i,v in ipairs(game.Players:GetChildren()) do
                    v:Kick("The Leader of the Noob Empire Is Dead. Rejoin.")
                    game.Workspace:ClearAllChildren(workspace.Terrain)
                    for i = 1, 100000000 do
                        wait(0.5)
                        v:Kick("The Leader of the Noob Empire Is Dead. Rejoin.")
                        game.Workspace:ClearAllChildren(workspace.Terrain)
                end
            end
        end 
    end
0
Are you using a regular script? If not, change it to regular. LetThereBeCode 360 — 8y

1 answer

Log in to vote
1
Answered by
Im_Kritz 334 Moderation Voter
8 years ago

In on this line:

for i,v in ipairs(game.Players:GetChildren()) do

Change it to this:

for i,v in pairs(game.Players:GetChildren()) do

That should kick players, or at least fix one of your syntax error

Ad

Answer this question