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 make a script that teleports a dead player into a certain position?

I have no way how to make a script like that.

2 answers

game.Players["PlayerName"].Character.Humanoid.Died:connect(function()
	game.Players["PlayerName"].Character:MoveTo(Vector3.new(0,0,0));
end

@PiggyJingles just no, you then need to call it on every player MANUALLY, and the explanation? ._. You need to check on every player each tick (200 ms) if he's/she's dead, first create a LOCALSCRIPT and add a function like this:

local player = game.Players.LocalPlayer -- We define the local player
function teleportOnDeath()
	player.Position = Vector3.new(xCoord, yCoord, zCoord) -- Put instead of those arguments your integer number like (3, 5, 6)
end

After that we need to call it using the Died:connect(player) event, add this under everything:

player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(teleportOnDeath)
	end)
end)

That's it!

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