I am making an elevator which teleports you at the end of the timer. Every time the timer ends, the game claims that the reserved server is restricted. I am trying to make a private server that only the people in the elevator can teleport to.
Here is the teleport module:
-- Services
local TeleportationService = game:GetService("TeleportService")
-- Variables
local TeleportationModule = {}
-- Main teleportation function
function TeleportationModule.Teleport(players)
if typeof(players) == "table" and #players > 0 then
-- Create a reserved server
local success, reservedServerCode = pcall(function()
return TeleportationService:ReserveServer(101052018455663)
end)
if success then
-- Attempt to teleport players to the reserved server
local teleportSuccess, errorMessage = pcall(function()
TeleportationService:TeleportToPrivateServer(
101052018455663, -- Place ID
reservedServerCode, -- Reserved server code
players -- List of Player objects
)
end)
if not teleportSuccess then
warn("Teleportation failed: " .. errorMessage)
end
else
warn("Failed to create reserved server: " .. reservedServerCode)
end
else
warn("No valid players to teleport!")
end
end
-- Returns the module
return TeleportationModule
Here is the link to the game: Space Gaem
Thank you, all help is appreciated.