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

Teleport Script help?

Asked by 10 years ago

I wrote my own script for teleporting. It doesn't work. What's wrong with it?

--Ok, so I am trying to make a teleport script.
function h(part)
    local h = part.Parent.findFirstChild("Humanoid")
    if (h ~= no) then
        h.Parent.MoveTo(Workspace.SpawnLocation.Position + Vector 3. new (0,4,0)
    end
    end
    -- I don't know where I went wrong. A little help?

3 answers

Log in to vote
1
Answered by 10 years ago

That's all wrong, this is not java! That's the fixed code:

yourPart.Touched:connect(part)
    local h = part.Parent:FindFirstChild("Humanoid")
    h.Parent:MoveTo(Workspace.SpawnLocation.Position + Vector 3. new (0,4,0))
end
0
I edited a little bit, refresh the page alessandro112 161 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Derp, WHy vector3 have space?

Log in to vote
0
Answered by
Hybric 271 Moderation Voter
10 years ago

Wow sorry it should be:

function AlessIsANoob(p)
local h = p.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
h.Parent:MoveTo(Workspace.PUT PART NAME HERE.Position + Vector3.new(0, 3, 0)
end
end

script.Parent.Touched:connect(AlessIsANoob) -- he needs lessons(Aless) cause i didnt do java.
0
On LINE 4 PUT A ")" NEXT TO THE "0" (Last 0!) Hybric 271 — 10y

Answer this question