I tested your code, I just disabled the surface gui stuff. I added a model, placed a “gate” so those functions are connected.
Added variables missing, like placeId, list, etc.
The code works normally, I got teleported to a reserved server.
You can enable again all those lines I disabled, those make no difference in the teleport, and change the placeId to your place id of course.
If the code still not working for you, its a different reason and not the script. (like you dont have rights to create a reserved server of that place id)
Actually I got a weird issue… I created a new file, I placed your code, I created a new place inside the game (never opened that place) then I went to test ingame and I got the same error 733… I tried a couple of times and it was the same… I went to the game file, opened the new place I created (by first time), published to roblox, and suddenly the Teleport started to work. If the place id that you are using is inside your game, and you never opened the place, maybe that could be the problem, it was for me…
local TS = game:GetService("TeleportService")
local list = {}
local teleporting = false
local placeId = 0000000
local function updateGui()
--billboard.Frame.players.Text = "Players: " ..#list.. "/5" -- Change the number 16 according to the Max Player who want to be teleported.
--billboard2.Frame.players.Text = "Players: " ..#list.. "/5"
end
local function removeFromList(character)
for i=1,#list do
if list[i] == character.Name then
table.remove(list,i)
updateGui()
end
end
end
local function teleportPlayers()
if #list > 0 then
--billboard.Frame.Status.Text = "TELEPORTING"
--billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
--billboard2.Frame.Status.Text = "TELEPORTING"
--billboard2.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
local playersToTeleport = {}
local teleportTime = 0
for i=1,#list do
if game.Players:findFirstChild(list[i]) then
table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
--TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
else
table.remove(list,i)
end
end
local code = TS:ReserveServer(placeId)
warn("Server Password:", code)
teleporting = true
TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
--repeat wait() until #list <= 0
--billboard.Frame.Status.Text = "READY"
--billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
--billboard2.Frame.Status.Text = "READY"
--billboard2.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
teleporting = false
end
end
script.Parent.Gate.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if teleporting == false then
local char = hit.Parent
local player = game.Players:FindFirstChild(char.Name)
local alreadyExists = false
for i=1,#list do
if list[i] == char.Name then
alreadyExists = true
end
end
if alreadyExists == false then
if #list < 2 then -- Many Players have been teleported.
warn("adding a player to TP list")
table.insert(list,char.Name)
--char.PrimaryPart.CFrame = spawnTeleport.CFrame
updateGui()
--leaveGuiEvent:FireClient(player)
end
player.CharacterRemoving:connect(function(character)
removeFromList(character)
end)
end
end
end
end)
--[[
leaveGuiEvent.OnServerEvent:Connect(function(player)
if player.Character then
player.Character.HumanoidRootPart.Anchored = false
wait()
player.Character.Humanoid.Jump = true
wait()
player.Character:MoveTo(game.Workspace.leaveRoomPart.Position)
removeFromList(player.Character)
end
end)
]]
while wait() do
timer = 15 -- Wait time before teleport change to whawtever you want it to be
for i=1,timer do
warn(i)
timer = timer - 1
--billboard.Frame.time.Text = timer
--billboard2.Frame.time.Text = timer
wait(1)
end
teleportPlayers()
end