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

Is it possible to have a function run when a player respawns?

Asked by 8 years ago

Does anyone know how to have a function run when a player respawns?

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
8 years ago

The CharacterAdded function. This triggers every time a Character is added. The event can be called from the Player model.

game.Players.LocalPlayer.CharacterAdded:Connect(function() -stuff- end)

or from a server script, as your localscript can reset too when the character respawns:

1game.Players.PlayerAdded:Connect(function(p)
2    p.CharacterAdded:Connect(function(c)
3        --stuff
4    end)
5end)
Ad

Answer this question