I made 3 teleporters and when you step on one, it teleports you to a random teleporter. But how would I prevent the teleporter that you touched from being the one you teleport TO? This script is in all three teleporters, and they are in a model.
math.randomseed(tick())
local teleporters = {script.Parent.Parent.Teleporter1,
script.Parent.Parent.Teleporter2,
script.Parent.Parent.Teleporter3
}
local randomteleporter = teleporters[math.random(1, #teleporters)]
script.Parent.Touched:connect(function(touchedPart)
if touchedPart.Parent:FindFirstChild("Humanoid") then
if touchedPart.Parent.Humanoid.Health > 0 then
touchedPart.Parent:MoveTo(randomteleporter.Position)
end
end
end)

2 comments
just remove the teleporter the script is in for the teleporters array.. not that hard to figure that out..
you know, now im contemplating why i didnt think of that