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 7 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
7 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:

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        --stuff
    end)
end)
Ad

Answer this question