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

What is wrong with this Teleporter Script?

Asked by
tanzane 100
9 years ago

Every time I touch the button that makes you teleport, It always says that vector3 isn't a member of Part. Can someone help me out?

Heres the script:

function Teleporter()
    script.Parent.vector3.new(workspace.SpawnLocation2.Position + Vector3.new(0,5,0))


end

script.Parent.Touched:connect(Teleporter)

1 answer

Log in to vote
2
Answered by 9 years ago

You din't write the script write. It should look like this.

function Teleport()
script.Parent.Position = Vector3.new(game.Workspace.SpawnLocation2.Position + Vector3.new(0, 5, 0))
end

--Or if you want to teleport the player.

function Teleport(Hit)
if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") then
Hit.Parent:MoveTo(game.Workspace.SpawnLocation2.Position + Vector3.new(0, 5, 0))
end
end

script.Parent.Touched:connect(function(Teleport)
0
Right* Spelling and capitalization are important in code, so they should be worked on. simple typos can lead to hours of debugging. (a versus A) iaz3 190 — 9y
0
Your connection line is wrong. It looks like you're almost doing an anonymous function, but "script.Parent.Touched:connect(Teleport)" will work fine. ZeptixBlade 215 — 9y
Ad

Answer this question