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

Teleporting upon Dieing! please Help?

I am creating a Game Universe that is base on survival. That at lobby it will random select players and send them to different games which are survival maps. Right now i don't know how to create a script that once a player dies they will be sent back to the lobby game. Please help me!

I still trying to learn how to script right now on scale of 1 to 10 i say i am at 1 right now.

The way i wanted the script is once player health reach 0 wait 5 sec then place telaport back to game ID ####### which is where the lobby.

Can you guys Help me?

2 answers

✓ Accepted answer

Instead of waiting until the player's HP equals 0, just use the event Died from the player's humanoid.

Here is how to use it, along with the rest of the script:

Place_ID = 0 -- The ID of the lobby.

game.Players.PlayerAdded:connect(function(P) -- Get the player.
	P.CharacterAdded:connect(function(C) -- Get the persons character.
		C:WaitForChild('Humanoid').Died:connect(function() -- Died event here.
		wait(5)
		game:GetService('TeleportService'):Teleport(Place_ID, P) -- Teleport the player.
	end)
end)
end)

Put this in a server script.

Sources:

1 comment

0

oh ok Thank You

us the died event

2 comments

0

use*

0

I upvoted your answer because it was correct, but you gave no information behind it as to what it does and you didn't even provide a link to a wiki page. It is recommended you provide valid source and a example script of the event.

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