Error while teleporting player to place

local Player = script:FindFirstAncestorWhichIsA("Player")
local TeleportService = game:GetService("TeleportService")

	local NewServer = TeleportService:ReserveServer(PlaceId)
	TeleportService:TeleportToPrivateServer(PlaceId, NewServer, Player)

This is the entire script, I just want to teleport the player to a reserved server, it should be simple. I replaced my game’s ID with “PlaceId”

I’ve tried putting the Player into a table: {Player} and it still didn’t work

Update on what happened. I was publishing the game several times and nothing was changing in the game at all. I tried printing in different parts of the script, but it never printed, and still errored on the same line.

I published the game and the StartPlace, and then it ended up working. I still think it’s kind of stupid that you can’t directly publish the game without publishing the StartPlace.