LocalScript Event of Player Respawn

How do I connect an event to a LocalPlayer spawning?

Something similar to:

game.Players.LocalPlayer.OnSpawn:Connect(function()
         print("yay!");
end)
1 Like

The event you’re looking for is Player.CharacterAdded, although you can take advantage of StarterCharacterScripts which parents scripts inside the player character, therefore running it every time they respawn:

--Script/LocalScript parented inside StarterCharacterScripts
local Character = script.Parent
print(Character, "yay!")

I didn’t even think of StarterCharacterScripts!! Thanks!

And StarterPlayerScripts for a similar purpose but for local scripts which should only be executed when the player first joins the game.

1 Like