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

Why will this not teleport the player after a event?

local player = game.Players.LocalPlayer

player.Character.Humanoid.Died:connect(function(teleport)
	print("I Died")
	wait(10)
	player.Character.Torso.CFrame = game.Workspace.Spawn.CFrame + Vector3.new(0,5,0)
end)

I made this and I am stumped on why it will not teleport the player. It will only print ("I Died") but it wont teleport the player. Any solutions?

1 answer

instead of using Died i'd suggest using

player.CharacterAdded:connect(function()
player.Character:WaitForChild("Torso")
player.Character.Torso.CFrame = game.Workspace.Spawn.CFrame + Vector3.new(0,5,0)
end)

The reason your script doesnt work is because the character gets replaced by a new one when the player respawns OR your script is in startergui instead of starterplayer.

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