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

Teleporter ain't working ?

Asked by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago

It just doesn't work lol, i don't know why i'm stuck on it 20 minutes ;-;

function teleportPlayer(pos, torso)
local char = torso
char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))

script.Parent.Touched:connect(function(part)
    teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
end)
end

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

Your function is not ran so your event will not trigger.

The problem:-

function teleportPlayer(pos, torso)
    local char = torso
    char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))

    script.Parent.Touched:connect(function(part)
        teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
    end)
end -- you close the function here

The fix:-

function teleportPlayer(pos, torso)
    local char = torso
    char.CFrame = CFrame.new(Vector3.new(pos.x, pos.y + 7, pos.z))
end -- close the function here

script.Parent.Touched:connect(function(part)
    teleportPlayer(Vector3.new(-31,2,95), part.Parent.Torso)
end)

Hope this helps

Ad

Answer this question