Reserve Server Error

  1. What do you want to achieve?

    so i was making a reserve server join gui .

  2. What is the issue?

    for some reason , the server just keep getting error and i dont even know whats the
    problem .

  3. What solutions have you tried so far?

    Server Script

local TeleportService = game:GetService("TeleportService")

local placeId = 6991639717
local TargetPlaceId = 7393896152

local GeneratedCode = TeleportService:ReserveServer(TargetPlaceId)

--Settings  // Make the code shorter 

local Digit = math.random(1,999999)
local FullCode = tostring(GeneratedCode.."-%-"..Digit)
local SplitCode = string.split(FullCode, "-%-")

print(SplitCode.." Code For Reserve Server ")

RemoteEvent.OnServerEvent:Connect(function(player, Code, SaveCode)

	if Code == "" then
	
		SaveCode = tostring(SplitCode)
		
		print("Code Successfully Saved !")
		
		TeleportService:TeleportToPrivateServer(7393896152, SplitCode, player)
		
	else
		
		TeleportService:TeleportToPrivateServer(7393896152, Code, player)
		
	end
end)

Local Script

local TextBox = script.Parent 
local Button = script.Parent.Parent.JoinButton

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteServer").JoinReserveServer

local SaveCode = game.Players.LocalPlayer.CodeServer -- // the reserve server code saved in player datastore

Button.MouseButton1Click:Connect(function()

	
	RemoteEvent:FireServer(TextBox.Text, SaveCode.Value)

end)

Here is a screenshot of the error

Capturereserve

i dont think i make the shorten code script correct , for some reason it keep printing something like this .

table : xx1ihi1h1nb237

i didnt even type table in front .

Read the documentation: TeleportToPrivateServer.

TeleportToPrivateServer only accepts a table of players to teleport, not a single player. If you are teleporting only one player you need to wrap them in a table. Check the code sample on the page for more information on how to teleport a single player to a private server.

2 Likes

then how am i gonna make player to join to reserve server and give other players the code??