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?
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:
us the died event