How do I check if the current server is a reserved server? I know that I can use the LocalPlayerArrivedFromTeleport event however that allows you to check only on the client but I'm looking for a way to figure this out on the server-side.
COMMUNITY QUESTION
How to check if a server is a reserved server?
1 answer
The DataModel (also known as the lua globals "game" or "Game") thankfully has two values you can use for managing reservations: VIPServerId and VIPServerOwnerId.
Under own testing, i found that when a server is not a reserved one (and therefore above values don't get affected), said values default to a blank string and 0 respectively.
Meaning:
print(game.VIPServerId) print(game.VIPServerOwnerId) (Semicolon is not necessary for Lua)
Returns:
--blank
0
Thus, if you wanted to check whether or not a server was VIP...
--This works on server and can work on client if game.Loaded is removed
game.Loaded:connect(function() --Fires when game loads for the first time. Just to make sure VIPServerId is processed, but this might not be needed after all.
if game.VIPServerId ~= "" then --We must add a string comparison, because string value holders cannot be nil
print("This server is a VIP server managed by user id " .. game.VIPServerOwnerId)
else
print("This server is a run-of-the-mill public server")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
use the event and relay it to a server script
yea I was thinking of that too but I was just wondering if there is another, more efficient way to do it