Here's my code:

game.ReplicatedStorage.TeleportEventwta.OnServerEvent:Connect(function(player, second, third, fourth)
	
	print("1ok")
	local players
	if second == "" or second == "nil" then
		
		players = {player}
		
	else
		
		if third == "" or third == "nil" then
			
			players = {player, second}
			
		else
			
			if fourth == "" or fourth == "nil" then
				
				players = {player, second, third}
				
			else
				
				players = {player, second, third, fourth}
				
			end
			
		end
		
	end
	local code = game["Teleport Service"]:ReserveServer(3315989953)
	game["Teleport Service"]:SetTeleportGui(game.ReplicatedStorage.TeleportGui:Clone())
	game["Teleport Service"]:TeleportToPrivateServer(3315989953, code, {players})
	
end)

The console prints out "1ok", so the TeleportEvent is fired, but it doesn't teleports (I know that the studio can't teleport, I publish it). If I replace the place id with game.PlaceId, it teleports me. Where's the problem?

3 comments

0

Put print("anything") in each if statement. This will help trace the error in your code, as in which if statement is causing the error.

0

Oh! The problem is at local code. So I think the game cant reserve a server? Can that be fixed?

0

The console also writes out that its not able to reserve, or something. Its forbidden.