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

How do I create a script that resets the character/player when he/she enters the game?

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

So I want to reset the player's character automatically as soon he/she enters the game. How can I do that? What should I put in the script that does that?

2 answers

Log in to vote
1
Answered by 10 years ago

Hmm, I'd probly do this (for a localscript);

wait(0) --Waits 0 seconds before script starts
repeat wait(0)until game.Players.LocalPlayer --Keeps waiting until LocalPlayer
if game.Players.LocalPlayer:FindFirstChild("RespawnedAlready")then --If script finds RespawnedAlready within LocalPlayer then
script:Destroy() --Destroys script
else --Else if didn't
Instance.new("BoolValue",game.Players.LocalPlayer).Name = "RespawnedAlready" --Makes the Value for RespawnedAlready
game.Players.LocalPlayer:LoadCharacter() --Respawns the LocalPlayer
end --The end for the 'if' statement

Hope this helped!

1
Thanks so much for your help! RAYAN1565 691 — 10y
0
No problem bro, glad to help! ;D TheeDeathCaster 2368 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Use as a script in workspace rather than a local script.

game.Players.PlayerAdded:connect(function(plr)
repeat wait() until plr.Character
plr.Character:BreakJoints()
end)

Answer this question