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

function onPlayerEntered(player)
    wait(3) 
    game.Workspace.Player.Torso.Position = Vector3.new(0, 50, 0)

end

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!

local player = game.Players.LocalPlayer --Identifies the Player
local character = player.CharacterAdded:wait() --Indentifies the character by waiting for for the character to be added into "player"
local root = character:WaitForChild('HumanoidRootPart') --Indentifies the HumanoidRootPart

function onPlayerEntered() --Names the Function
    wait(3) --Waits 3 seconds
    root.CFrame = CFrame.new(Vector3.new(0, 50, 0)) -- Sets CFrame of the HumanoidRootPart to the location of where you want to be teleported
end
game.Players.PlayerAdded:connect(onPlayerEntered()) --Connects the function

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

Ad

Answer this question