Issue with TeleportToPrivateServer

G’Day
I’m trying to utilize TeleportToPrivateServer so that any new players cant join any existing players.
I thought it was working properly but it seems it isn’t now, not sure if it has anything to do with how I’ve used the que function or if I’ve made a mistake with the Teleport function.
Any help is greatly appreciated.

Below is a corresponding section of my code which is in a normal script and is located in server script service

local code = TS:ReserveServer(7204521869)
local Queue = {}
local alreadyExists = false


AddToQueue.OnServerEvent:Connect(function(plr)
	for i=1,#Queue do
		if Queue[i] == plr.Name then
			alreadyExists = true
		end
	end

	if alreadyExists == false then
		if #Queue < 6 then		
			table.insert(Queue, plr)
			for index, player in pairs(Queue) do				
				wait(1)
				StartTimer:FireAllClients(30)					
				TeleportNow.OnServerEvent:Connect(function()
					TS:TeleportToPrivateServer(7204521869, code, Queue)										
					Queue[index] = nil
	            end)
            end
		end	
	end			
end)
1 Like

Your Queue table is only available to that one script and not universally. Either, you can create a few functions that import/exports players into a datastore to check the queue or you can figure out a method to get the players in a server for a maxed-out server.

1 Like

looks like I have some research to do then as I’m not exactly sure how I would go about adding/removing players from que to a datastore, cheers for the help & reply

No problem, I recommend using either chat service or profile service for cross-server communication.

1 Like

I’ll look into both of them, thanks again