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

How to make a teleporter that can teleport to two places?

Asked by 4 years ago

I want to be able to make a teleporter with a random chance to go to one place and a random chance to go to another (not another place as in game but as an area)

0
i might be able to make 1 where it teleports you, but not randomly to two.. Rat_1003 -5 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

you should not request for someone to make a script for you but ill make it anyway put this inside the teleport part

local part = script.Parent
part.Touched:Connect(function(hit)
    local random = math.random(1,2) -- you can change the max number depend on how many you want to random the tp

    if hit.Parent:FindFirstChild("Humanoid") ~= nil then
        if random == 1 then
            hit.Parent.HumanoidRootPart.Position = workspace.TP12.Position -- change it if you want

        elseif random == 2 then
            hit.Parent.HumanoidRootPart.Position = workspace.TP22.Position -- change it if you want

        end
    end
end)
Ad

Answer this question