Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is waiting on events a thing?

So, I discovered that you could do something like this:

game.Players.LocalPlayer.Character.Humanoid.Died:wait()

So, does that basically wait until the character dies?

1 answer

✓ Accepted answer

Yes, using :Wait() after an event instead of :Connect() will wait for the event to fire.

--// Example
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local humanoid = char:WaitForChild("Humanoid")

		humanoid.Died:Wait()
		print(plr.Name.." Died!")

	end)
end)

2 comments

0

Okay, awesome! Thanks, I really needed to know that worked for sure.

1

And returns any arguments that event give ;)

This discussion is preserved as it was. New answers, comments, and votes are closed.