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

How do I teleport myself to a part/brick?

Asked by
Vividex 162
7 years ago

I'm trying to teleport myself to a part using a script but it's not working:

game.Workspace.Vividex.Torso.CFrame = CFrame.new(Vector3.new(game.Workspace.Coin.CFrame))

Sorry if I'm totally off, I'm a nub when it comes to scripting :c

2 answers

Log in to vote
0
Answered by 7 years ago

I believe that the primary issue here is that you cannot create a Vector3 from a CFrame. Fortunately, you can access the positional part of a CFrame via the member 'p':

    game.Workspace.Vividex.Torso.CFrame = CFrame.new(game.Workspace.Coin.CFrame.p)

Also, you could just create it via the Position property

    game.Workspace.Vividex.Torso.CFrame = CFrame.new(game.Workspace.Coin.Position)
0
didn't work :c Vividex 162 — 7y
0
Well, that depends on a number of things: Where are you running this code? SwardGames 325 — 7y
Ad
Log in to vote
0
Answered by
Sur4y 40
7 years ago

Hello there!

You can use :MoveTo() command to move your character to somewhere else. so, in this case, it'd be

game.Workspace.Vividex:MoveTo(game.Workspace.Coin.Position)

i hope this works; give it a try!

Answer this question