I was testing a teleport where when you touched a part outside of the Lobby, it would teleport you back into the lobby. There was this error, here is my code and the error: Error:
22:25:09.867 - Workspace.Workspace.Sea.Script:12: bad argument #2 to 'random' (interval is empty)
22:25:09.868 - Stack Begin
22:25:09.869 - Script 'Workspace.Sea.Script', Line 12
22:25:09.869 - Stack End
Code:
script.Parent.Touched:Connect(function(hit)
local Humanoid = hit:FindFirstChild("Humanoid")
if Humanoid ~= nil then
wait()
else
print("Humanoid touched "..script.Parent.Name..".")
local rootPart = hit:FindFirstChild("HumanoidRootPart")
local spawns = {
spawn1 = game.Workspace.lobbySpawn1.CFrame,
spawn2 = game.Workspace.lobbySpawn2.CFrame
}
rootPart.CFrame = spawns[math.random(1,#spawns)]
local Success = "successTeleport"
end
end)
Thank you, I hope to recieve an answer.

1 comment
By the way, the local Success = "successTeleport" code is something i'm doing along side the script.