Hi, I have a script that, if a player touches a brick and the player count is 2 or more, all players will be teleported to a separate place (part of same game.) I changed the place id to 0 in the post for privacy reasons, but I'm positive its valid in the actual code. Here's the code.
local TeleportService = game:GetService("TeleportService")
local code = TeleportService:ReserveServer(game.PlaceId)
local placeId = 0
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
local players = game.Players:GetChildren()
if #players >= 2 then
wait(5)
TeleportService:TeleportToPrivateServer(placeId, code, players)
end
end
script.Parent.Touched:Connect(onPartTouch)
However, when 2 players join the game in the Roblox application (not studio) and touch the brick, I get a Roblox error that says "teleport failed due to an unexpected error. (Error code: 769)" The script is a regular script inside of the brick that is being touched. Should I change it to local? Can someone tell me why this is happening? Thanks.

2 comments
So according to my resources the placeId should actually be local placeId = TS:ReserveServer(0), since it's a reserved server you'll need to do it like that
I tried changing it to that but unfortunately it didn't work, thanks for trying to help.