Is it possible to make a teleporter that teleports you to one block or another randomly? I tried but it isn't working. I am also trying to make it click-activated. This is my (normal) script inside the teleporter
function Click(Player, teleport) if Player.Parent:FindFirstChild("HumanoidRootPart") then local human = Player.Parent.HumanoidRootPart teleport = math.random(1,2) if teleport == 1 then human.Position = Vector3.new(-875.194, -71.321, -1068.287) end -- Destination A if teleport == 2 then human.Position = Vector3.new(-875.194, -71.321, -931.699) end -- Destination B end end script.Parent.ClickDetector.MouseClick:Connect(Click)
The MouseClick event passes the player who clicked, not what touched it. You seem to be getting it confused with the Touched event of parts. Additionally, you should teleport with CFrame, and not Vector3. By changing the position you're literally moving the HumanoidRootPart to the coordinates and not the entire character. Using CFrame, you move the entire character.
local function Click(Player) local teleport = math.random(1,2) if teleport == 1 then Player.Character:SetPrimaryPartCFrame(CFrame.new(-875.194, -71.321, -1068.287)) else: Player.Character:SetPrimaryPartCFrame(CFrame.new(-875.194, -71.321, -931.699)) end end script.Parent.ClickDetector.MouseClick:Connect(Click)