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

How do I teleport a player when he dies ?

If possible, when dying be teleported to a different world Thank you

1 answer

Hi Eds456oficial,

The humanoid has a .Died event that fires upon the death of it. I would just connect that to the TeleportService and make that work. Something along these lines would probably work:

local players = game:GetService("Players"); -- The players service
local teleport = game:GetService("TeleportService"); -- The teleport service
local id = 226039913; -- The id of the place, can be found in the url when you're on the page of the game.

players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid"); -- The humanoid of the character.

		hum.Died:Connect(function()
			teleport:Teleport(226039913, plr);
		end)
	end)
end)

##Well, I hope I helped and have a nice day.

Thanks,

Best regards,

~~ KingLoneCat

6 comments

0

Thx man

0

np

0

Hey you want to play the game with me? I'll pay you 35 robux okay?

0

What game?

0

FortNite

0

Sorry, I am not such a big fan of Fortnite, especially the one on Roblox.

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