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

Could you respawn players using "GetChildren()" on a Server Script?

Asked by 4 years ago

I'm trying to make code where it will spawn all players at once, but i'm kind of a noob to for-loops and i'm using a server script.

here's my (sort of) code:

function wavespawn() 
for _,v in pairs(game.Players:GetChildren()) do
    v:LoadCharacter()
end
end

it's not done, so anything that could help would be good. Thanks!

1 answer

Log in to vote
3
Answered by
0_2k 496 Moderation Voter
4 years ago

Try to refrain from using GetChildren() whilst calling players on certain situations, this should work regardless.

function wavespawn()
    for _,v in pairs(game.Players:GetPlayers()) do
        v:LoadCharacter()
    end
end
Ad

Answer this question