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

How do i teleport a player after they have died?

I was wondering how i would wait for a player to respawn and then teleport them to a certain position.I have tried this but it teleport them right when they die and just there torso.

Player.CharacterAdded:connect(function(character)
			character:WaitForChild("Humanoid").Died:connect(function()
				if start == false then
						print("They have not pressed it")
						
					character.Torso.CFrame = CFrame.new(workspace.Lobby.Spawns.Part.Position)
						
					end
				
			end)
		end)

2 answers

✓ Accepted answer

You already have a CharacterAdded event, which fires every time a character is added to the player. A Died event is not necessary, since CharacterAdded fires when a player respawns, or gets a new character.

I'm assuming you have a 'Player' variable and a 'start' variable defined somewhere.

Player.CharacterAdded:connect(function(character)
	if start == false then
		print("They have not pressed it")
		character:WaitForChild("Torso").CFrame = CFrame.new(workspace.Lobby.Spawns.Part.Position) --The wait for child is just in case the torso is not loaded when the event fires, due to lag. 
	end
end)

2 comments

0

When i try this in studio the players torso does not go to the location

0

Read it now

Character isn't a thing,you have to do game.Players.Character Here is the script

Player.CharacterAdded:connect(function(character)
            character:WaitForChild("Humanoid").Died:connect(function()
                if start == false then
                        print("They have not pressed it")

game.Players.Character.Torso.CFrame = CFrame.new(workspace.Lobby.Spawns.Part.Position)

                    end

            end)
        end)

5 comments

0

That is incorrect.

0

Why does everyone -1 my questions :( Because i have 100 questions that has a code that isn't even close to being right i quit scripting helpers time to keep learning how to script on wikihow

0

And also tell the creator of scripting helpers i'm quitting and learning how to script on wikihow

0

Your script is completely incorrect on line 06 and you did not help to fix the problem at all, therefore was downvoted.

0

maybe shut the hell up

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