I am trying to make a randomizing teleporter but the problem is that when using math.random and when I take the teleporter, it always teleport me to the same position. I am looking how to randomize each time the script is run.
local debounce = true
local team = game:GetService("Teams")["O5 Council"]
local sup = math.random(1,4)
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).Team == team and sup == 1 then
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
hit.Parent:MoveTo(Vector3.new(207.36, 288.05, 483.315))
wait(0.5)
debounce = true
return sup
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).Team == team and sup == 2 then
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
hit.Parent:MoveTo(Vector3.new(908.906, 122.288, 1034.539))
wait(0.5)
debounce = true
return sup
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).Team == team and sup == 3 then
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
hit.Parent:MoveTo(Vector3.new(1062.403, 202.746, 650.385))
wait(0.5)
debounce = true
return sup
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).Team == team and sup == 4 then
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
hit.Parent:MoveTo(Vector3.new(970.813, 199.222, 672.873))
wait(0.5)
debounce = true
return sup
end
end
end
end)

1 comment
Doesn't help but thank you.