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

Why does this not TP the person?

Asked by 9 years ago

It has been working until I used Clonetrooper109 or whatever's Intro camera. I added scripts where when you click the skip "I renamed mine play" it spawns a plane and it SUPPOSED to TP the character to the aircraft but it isn't TPing. It's in a localscript and the parents go all the way to the Workspace. Please help!

function Click()
    wait (2)
script.Parent.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-1884, 24, 1083)
end

script.Parent.MouseButton1Down:connect(Click)

1 answer

Log in to vote
1
Answered by 9 years ago

When using a LocalScript, you can use:

game.Players.LocalPlayer

to get the Player.

Using this, grab the character using the character property of the player, and change the torso's CFrame:

local Player = game.Players.LocalPlayer

function Click()
local S = Player.Character.Torso
S.CFrame = CFrame.new(-1884, 24, 1083)
end

script.Parent.MouseButton1Down:connect(Click)
0
WOAH!! It worked!!!!! Thanks so much man!! VirtualFlying 55 — 9y
Ad

Answer this question