I'm making a camping type game and I'm using Reserve server to make a new server so players can't go to the same server, I wrote the code and it doesn't work, I browsed over 50+ pages and it's still not working, Can anyone help me?
Code:
local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(7140418017)
teleportService:TeleportToPrivateServer(7140418017, code, unpack(plrs)) -- getting every player in a table and teleporting them
Full Code:
local teleportService = game:GetService("TeleportService")
local code = teleportService:ReserveServer(7140418017)
local plrs = {}
local buttonPart =game.Workspace:FindFirstChild("MainLobby"):FindFirstChild("TouchParts"):FindFirstChild("TouchPart2")
local infoPart = game.Workspace:FindFirstChild("MainLobby"):FindFirstChild("InfoPart2")
local infoText = infoPart:FindFirstChild("SurfaceGui"):FindFirstChild("TextLabel")
local bus = game.Workspace:FindFirstChild("MainLobby"):FindFirstChild("Buses"):FindFirstChild("Bus2")
local teleportPart = bus:FindFirstChild("TPPart")
local cooldown = false
local timer = 30
game:GetService("Players").PlayerAdded:Connect(function(player)
player:WaitForChild("PlayerGui"):WaitForChild("LeaveGui"):WaitForChild("LeaveButton").MouseButton1Click:Connect(function()
player.Character:WaitForChild("Humanoid").Health -= 100
table.remove(plrs, table.find(plrs, player))
player:WaitForChild("PlayerGui"):WaitForChild("LeaveGui").Enabled = false
end)
end)
buttonPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if cooldown == false then
cooldown = true
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
local char = hit.Parent
table.insert(plrs, player)
char:WaitForChild("HumanoidRootPart").CFrame = teleportPart.CFrame
player:WaitForChild("PlayerGui"):WaitForChild("LeaveGui").Enabled = true
wait(1)
cooldown = false
end
end
end)
while true do
wait()
for i = timer,0,-1 do
infoText.Text = "Time until leaving: "..i.." Players: "..#plrs
wait(1)
end
cooldown = false
infoText.Text = "Teleporting..."
teleportService:TeleportToPrivateServer(7140418017, code, plrs)
wait(10)
cooldown = true
end

5 comments
Expected identifier when parsing expression, got )
Are you sure you pasted your code exactly? I don't see any extra parentheses in my post or yours.
Thats weird
Sorry but it didn't work
I fixed the error but it doesn't work