Teleport not working

Hi, I’m trying to make it so that if the player presses a button, a tag is inserted and an event firing happens. I’m trying to make it so that the player with the tag teleports. Here is my code:

local TS = game:GetService("TeleportService")
local RacingServerID = NUMBER ID
local ReservedServer = TS:ReserveServer(RacingServerID)

game.ReplicatedStorage.Events.AddPlayerToRoom.OnServerEvent:Connect(function(player)
	local PlayerList = {}
	
	table.insert(PlayerList, player)
	
	for i, v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("Room1") then
			TS:TeleportToPrivateServer(RacingServerID, ReservedServer, v)
		end
	end
	
end)

Were there any error messages in the output section?

1 Like

No errors occurred. That’s what’s messing me up too.

Was that supposed to be like that? That’s probably the cause of the issue.

It has a number ID. just replaced it with text so that it wouldn’t be revealed

Did you even use those 3 lines?

What’s Room1? A gui? Tool or something else? If it is one of these, you should’ve been looking for them in the PlayerGui/Backpack.

Edit: In the start of the function, place print("Test"), and check if that function is even being fired.

It is fired. The table is going to be used later

Correct me if I’m wrong, but I’m pretty sure you can only teleport players to reserved servers in a table format. For example,

TS:TeleportToPrivateServer(RacingServerID, ReservedServer, PlayerList)