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

How to respawn all players?

Asked by 6 years ago

I am working on a game that teleports all players to a sort of lobby, after a set time I want all the players to respawn, like from admin commands where it does not go through the death wait

2 answers

Log in to vote
0
Answered by
dispeller 200 Moderation Voter
6 years ago
for num,player in pairs(game.Players:GetPlayers()) do
    player:LoadCharacter()
end

Make sure you have this inside a (Server) Script and not a LocalScript as you can only call LoadCharacter from a server sided script.

Ad
Log in to vote
0
Answered by
Kegani 31
6 years ago

Try this script:

while wait() do
    wait(5) -- edit the "5" to whatever you'd like (seconds)
    for i,v in ipairs(game.Players:GetChildren()) do
        v:LoadCharacter()
    end
end

Answer this question