I have a big problem, i’m creating a elevator that after like 15 seconds teleports all players into a reserved server.
The problem is on the Teleport part. When i try to teleport gave me an error with
raiseTeleportInitFailedEvent: Teleport failed because This game is not published. (Unauthorized)
I published all the places, and everything. It doesn’t work.
I think is not the script.
Help me, please.
The Code:
local sendReserve = TeleportService:ReserveServer(code)
teleporting = true
local succ,err = pcall(function()
TeleportService:TeleportToPrivateServer(code, sendReserve, playersTeleport)
end)
if succ and not err then
repeat wait() until #playersTeleport <= 0
billboard.Main.Countdown.Text = "Ready..."
teleporting = false
elseif not succ and err then
print("Teleport Failed: ", err)
end
It’s a function i forgot to put all of the code sorry!
local function teleportToServer()
if #usersTeleporting > 0 then
billboard.Main.Countdown.Text = "Teleporting..."
local playersTeleport = {}
local teleportTime = 0
for i = 1, #usersTeleporting do
local player = Players:GetPlayerByUserId(usersTeleporting[i])
if Players:FindFirstChild(player.Name) then
table.insert(playersTeleport, player)
else
table.remove(usersTeleporting, getIndex(usersTeleporting, player.UserId))
end
end
local sendReserve = TeleportService:ReserveServer(code)
teleporting = true
local succ,err = pcall(function()
TeleportService:TeleportToPrivateServer(code, sendReserve, playersTeleport)
end)
if succ and not err then
repeat wait() until #playersTeleport <= 0
billboard.Main.Countdown.Text = "Ready..."
teleporting = false
elseif not succ and err then
print("Teleport Failed: ", err)
end
end
end