My Code:
local List = {}
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local SafeTeleport = require(ServerScriptService.SafeTeleport)
game.ReplicatedStorage.Join.OnServerEvent:Connect(function(Player)
table.insert(List,Player.Name)
end)
repeat
wait(5)
if #List >= 2 then
local Player1 = List[math.random(1, #List)]
local Player2 = List[math.random(1, #List)]
repeat
local Player2 = List[math.random(1, #List)]
until Player1 ~= Player2
local ActualPlayer1 = game.Players:FindFirstChild(Player1)
local ActualPlayer2 = game.Players:FindFirstChild(Player2)
function removeFirst(tbl, val)
for i, v in ipairs(tbl) do
if v == val then
return table.remove(tbl, i)
end
end
end
removeFirst(List, Player1)
removeFirst(List, Player2)
local reservedServerCode = TeleportService:ReserveServer(9946910072)
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ReservedServerAccessCode = reservedServerCode
SafeTeleport(game.PlaceId, {ActualPlayer1,ActualPlayer2}, teleportOptions)
end
until false
the error i get:
im bassicly trying to teleport 2 players from main place to 1v1 place