So, I discovered that you could do something like this:
1 | game.Players.LocalPlayer.Character.Humanoid.Died:wait() |
So, does that basically wait until the character dies?
Yes, using :Wait()
after an event instead of :Connect()
will wait for the event to fire.
01 | --// Example |
02 | game.Players.PlayerAdded:Connect( function (plr) |
03 | plr.CharacterAdded:Connect( function (char) |
04 | local humanoid = char:WaitForChild( "Humanoid" ) |
05 |
06 | humanoid.Died:Wait() |
07 | print (plr.Name.. " Died!" ) |
08 |
09 | end ) |
10 | end ) |