Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport someone after a cutscene?

Asked by 7 years ago

I need to teleport someone upon entering, about 3 seconds after they join. I tried

1function onPlayerEntered(player)
2    wait(3)
3    game.Workspace.Player.Torso.Position = Vector3.new(0, 50, 0)
4 
5end

Didn't do anything. I am using a spawn part if that is useful.

Thanks,

CallKnuss

0
one recommendation use HumanoidRootPart to teleport. outlook1234567890 115 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

A simple fix to your problem would be to move the Humanoid Root by CFraming. This eliminates the outcome of killing the player. Also you need to connect the function, and list variables to gather information on what the HumanoidRootPart is.

Heres the script!

1local player = game.Players.LocalPlayer --Identifies the Player
2local character = player.CharacterAdded:wait() --Indentifies the character by waiting for for the character to be added into "player"
3local root = character:WaitForChild('HumanoidRootPart') --Indentifies the HumanoidRootPart
4 
5function onPlayerEntered() --Names the Function
6    wait(3) --Waits 3 seconds
7    root.CFrame = CFrame.new(Vector3.new(0, 50, 0)) -- Sets CFrame of the HumanoidRootPart to the location of where you want to be teleported
8end
9game.Players.PlayerAdded:connect(onPlayerEntered()) --Connects the function

I hope this helped, please comment if you have any questions or concerns!

Ad

Answer this question