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

i was trying to make teleporters but they dont work?

Asked by 4 years ago

heres the script local T1 = game.Workspace.Teles.T1 local T2 = game.Workspace.Teles.T2 function tele(Part) local hum = Part.Parent:findFirstChild("Humanoid") if (hum ~= nil) then hum.Torso.CFrame = CFrame.new(T2.Position+Vector3(0,3,0) end end

0
i dont know why but the script in the description messed up and it looks weird TFlanigan 86 — 4y
0
put this in a code block, this is unreadable Gameplayer365247v2 1055 — 4y
0
bruh i did but the site messed it up TFlanigan 86 — 4y

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
4 years ago

If I've read this right, it should be something like this:

-- teleport variables 
local Teleport1 = workspace.Teles.T1
local Teleport2 = workspace.Teles.T2

Players = game:GetService('Players')

Teleport1.Touched:Connect(function(otherPart) -- touched function
    if otherPart.Parent:FindFirstChildOfClass('Humanoid') ~= nil then -- potential player
        local player = Players:GetPlayerFromCharacter(otherPart.Parent) -- player from character
        if player then -- if player
            player.Character.HumanoidRootPart.CFrame = Teleport2.CFrame + Vector3.new(0,2,0) -- added Y axis + 2 to prevent being TPed into the ground/teleport.
        end
    end
end)
0
i already found the error i didnt do vector3.new TFlanigan 86 — 4y
0
but still thanks TFlanigan 86 — 4y
Ad

Answer this question