My program will teleport the people to a private server. HTTP and API is enabled. PlayersToTeleport is a table. Why is this giving me an error?
local TS = game:GetService("TeleportService") local code = TS:ReserveServer(4830926172) TS:TeleportToPrivateServer(4830926172, code, PlayersToTeleport)
here is your problem the players to teleport needs to be a table of player for example you could have the script get players
local TS = game:GetService("TeleportService") local code = TS:ReserveServer(4830926172) local players = game.Players:GetPlayers() TS:TeleportToPrivateServer(4830926172, code, PlayersToTeleport)
but if you are trying to make them teleport when touched
local part = script.Parent -- when this is touched it will trigger the event i will leave it as ----- script.parent local tableplayers = {} part.Touched:Connect(function(hit) -- the argument if game.Players:GetPlayerFromCharacter(hit.Parent) then local player = game.Players:GetPlayerFromCharacter(hit.Parent) table.Insert(tableplayers, player) end end) -- maybe a while true do statement here? while true do wait(25) TS:TeleportToPrivateServer(4830926172, code, tableplayers) end
-- im sure this will work if it does not tell me