Help with Teleporting players to a reserved server

I’m trying to make a system, where a reserved server is made for groups of people; then whenever they leave the reserved server, and go rejoin the main game, it asks the player if they want to rejoin the same reserved server again.

What I did in this script was once the reserved server has been made using a new Code and Id, it saves it into the player’s data, which I then take back out to reuse the code once the player has rejoined the main game, and agreed to rejoin the reserved server.

joinLastGame.OnServerEvent:Connect(function(player)
	local playerId = ps:GetUserIdFromNameAsync(player.Name)

	local success, result = pcall(function()
		return playerDataDB:GetAsync(playerId)
	end)
	
	local playerData = require(script.PlayerData).new(player, http:JSONDecode(result))
	
	TeleportOptions.ReservedServerAccessCode = playerData["LastGameCode"]
	print(playerData["LastGameCode"]) -- Gives me the correct Code for the reserved server
	
	local Success, Result = pcall(TeleportService.TeleportAsync, TeleportService, 15632385326, player, TeleportOptions)
	
	if Success then
		print("success") -- Doesn't print
	end
	
end)

The output gave me the correct Reserved Server Code from when I just created it, yet it doesn’t print “success”. Please note that I’m still learning about TeleportServices

boost aaaaaaa

I think you meant:
pcall(function() TeleportService:TeleportAsync(...) end)

Put the player in the table:

pcall(TeleportService.TeleportAsync, TeleportService, 15632385326, {player}, TeleportOptions)

players: [Objects] | An array of the player(s) to teleport.

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