How to check if game is private or not

For example if you use the function TeleportToPrivateServer() of the Teleport service it creates a private server so why I want to see if the instance of game is private is because if you use TeleportToPrivateServer() you can pass data to the next game the players was teleported to but this data can only be retrieved on client side so in a local script using TeleportService:GetLocalPlayerTeleportData() which returns the data if any was supplied by TeleportToPrivateServer(). But I want players to be split up into 2 teams but the team the player is on will be determined by which team they chose before they where teleported to a private server but since I get the data in a local script I then use a remote function in that local script but this remote function can be exploited so I want to check if the remote function is triggered it will check if the server is private if it is not private then the code won’t run.

2 Likes

Here is how you can check if a server is a private server.

7 Likes

Okay so thanks to Kacper for that post it led me in right direction since.

game.PrivateServerOwnerId is for VIP server.
game.PrivateServerId is to see if it is private server or not if it returns an empty string that means it is not a private server id.

5 Likes