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

how can you create a small block of code that respawns all players?

Asked by 10 years ago

I am making a training center for my group and when i load a map i want it to respawn all player but i dont know how could someone help?

2 answers

Log in to vote
0
Answered by 10 years ago

This script needs to be in a Regular server-side http://wiki.roblox.com/index.php?title=Script.

Use :LoadCharacter() to respawn the players. You can also do :LoadCharacter(false) or :LoadCharacter(true). :LoadCharacter(true) respawns them normally and :LoadCharacter() and :LoadCharacter(true) is the same thing. :LoadCharacter(false) respawns the player but lets say you change their CharacterAppearence then :LoadCharacter(false), the CharacterAppearence doesn't apply to them.

for _, player in pairs(game.Players:GetPlayers()) do
    if player.Character then --Checks to see if the player is a legit one.
        player:LoadCharacter() --Respawns player
    end
end
Ad
Log in to vote
-1
Answered by 10 years ago
for _,v in pairs(game.Players:GetPlayers()) do
    v:LoadCharacter()
end

That snippet should do it.

0
Please explain how it works because gavnnater45 won't understand how it works. EzraNehemiah_TF2 3552 — 10y

Answer this question