Does anyone know how to have a function run when a player respawns?
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:
1 | game.Players.PlayerAdded:Connect( function (p) |
2 | p.CharacterAdded:Connect( function (c) |
3 | --stuff |
4 | end ) |
5 | end ) |