How do I detect a players respawn?
Asked by
6 years ago Edited 5 years ago
I'm trying to run this code every time the player respawns
-- This is what is executed when the player joins the game.
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | local particle 1 = game.ReplicatedStorage.ParticleEmitter |
03 | local particle 2 = game.ReplicatedStorage.ParticleEmitter 2 |
04 | local death = game.ReplicatedStorage.death |
05 | local theCharacter = workspace:WaitForChild(player.Name) |
06 | if theCharacter.Humanoid ~ = nil then |
07 | particle 1 :Clone().Parent = theCharacter.Torso |
08 | particle 1 :Clone().Parent = theCharacter.Head |
09 | particle 1 :Clone().Parent = theCharacter [ "Left Arm" ] |
10 | particle 1 :Clone().Parent = theCharacter [ "Right Arm" ] |
11 | particle 1 :Clone().Parent = theCharacter [ "Left Leg" ] |
12 | particle 1 :Clone().Parent = theCharacter [ "Right Leg" ] |
13 | particle 2 :Clone().Parent = theCharacter.Torso |
14 | particle 2 :Clone().Parent = theCharacter.Head |
15 | particle 2 :Clone().Parent = theCharacter [ "Left Arm" ] |
16 | particle 2 :Clone().Parent = theCharacter [ "Right Arm" ] |
17 | particle 2 :Clone().Parent = theCharacter [ "Left Leg" ] |
18 | particle 2 :Clone().Parent = theCharacter [ "Right Leg" ] |
19 | death:Clone().Parent = theCharacter |
But I need to run this code again on the player that respawns. How would I do that?