Making server list with create button

Hi I am trying to make a server list with create button

At this line here, is ID the JobId or is it the AccessCode. Because from what I can tell, your ‘AccessCode’ isn’t saved in a table anywhere for the server to grab.

If its what I think, which the JobId, then that’s why others are unable to join that ReservedServer.

For testing purposes, just have AccessCode stored in the above server code like,

local ServerCode = nil

--.... a few lines later

game:GetService("ReplicatedStorage"):WaitForChild("CreateServer").OnServerEvent:Connect(function(player)
	
	local AccessCode = TPS:ReserveServer(13628003081)
	ServerCode = AccessCode
	TPS:TeleportToPrivateServer(13628003081, AccessCode, {player})

end)

-- Then when a player requests to join the already created sever, say player2

game:GetService("ReplicatedStorage"):WaitForChild("JoinServer").OnServerEvent:Connect(function(player, ID)
	
	print(ID)
        -- temporarily changed the 'ID' arg below in argument 2 to ServerCode 
	game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId,ServerCode , {player})
	
end)

For a more permanent solution, I’d recommend create a table that stores SELECT message.Data received from the Messaging Service. For example, I’d capture the JobId of the new server so I can store it inside of a table along with the accesscode.

I wish you luck.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.