Introduction
Hello everyone! In this post, I will be explaining the differences between a server and a server instance, and other programming aspects that have to do with how servers work in Roblox, related to :ReserveServer method.
I will explain through a TeleportService perspective!
Server vs Server Instance
Firstly, in this post I will talk about two terms that, although their names are invented, I use them so you can understand it better:
A server instance is a running server in Roblox, whereas a server would be the “.Parent” of that server instance containing the information about it.
To clear doubts, and as an example, let’s create a private server in our game!
Once created, let’s join it, the private server will create a server instance with that information.
As you can see, this is the private server id of the server.
Now, let’s leave, and wait for the server to end. It will end when everybody has left, but it is possible that we have to wait because Roblox has to decide whether it should be closed yet. Once it ends, we join our same private server again but it will create a new server instance:
See? Even though they are different server instances, they have the same information.
Types of servers:
-
Private Servers:
- Reserved Servers
- Owned Private Servers
-
Public Servers (no subtypes)
Both reserved servers and owned private servers work very similarly.
The only difference between both is that reserved servers have access codes that the developer can access, while owned private servers have URLs that cannot be changed or edited by the developers, but by the owner (and maybe more things managed internally by Roblox). You wouldn’t want a developer being able to place people inside your private server.
Reserved servers do not have an owner.
Both types of private servers will have a consistent private server id and access code, in the case of reserved servers.
Supposedly, only one server instance should be running for one server, but there’s an issue that I will be explaining at the end of this post.
JobId, PrivateServerId, AccessCode
-
JobId is the simplest of them all, it is given to each and every server instance, and is unique. This means that it will never be used again. All server instances have job Ids, and unique, even if it was possible to have two server instances belonging to the same server (it is possible, see the end of the post).
-
PrivateServerId will be associated with each server that is private (not server instance, since it persists for every server instance of said server).
-
AccessCode will be associated with private reserved servers.
The information associated with servers will persist, PrivateServerId and AccessCode.
How does :ReserveServer work?
Well, as the docs site states, the server is created once :ReserveServer is called. However, no server instance is made until the AccessCode is used, with TeleportService, for example. This is quite identical to how owned private servers work. If you haven’t understood yet, try joining a reserved server 10 days later.
Let’s take a look at this button:
You can imagine :ReserveServer working similarly to how that button would work. It creates an owned private server but doesn’t start a server instance yet until you join it. This is the reason why :ReserveServer cannot return a JobId, JobId is only associated with SERVER INSTANCES. A lot of people fail to understand this and end up asking Roblox to add this, when they should use MessagingService to know the JobId, if it was running in the first place.
When teleporting…
Although changes have rolled to TeleportData, TeleportSettings, and TeleportAsync, that is only server-sided, the client is still used as the method of transporting that data, and there’s no server to listen to that. That’s the reason why TeleportService shouldn’t be used on important things, data transportation.
Issues you need to know
-
“Xbox duplicated servers”
As stated by the Roblox staff, this is currently not intended behavior and can mess up stuff (see the post for more). You should have a verification system in place, if needed, to prevent two servers from managing the same data, as an example. -
Ability to get into any Place within an Experience without the need of teleporting from the Start Place. Although Roblox has recently patched this, you shouldn’t depend on others. You should be scripting to prevent this from happening, even if it cannot happen. This is an important tip: “Prevention beats cure”. A good example would be having two places, where one of them is not the Start Place and is supposed to be playable ONLY if its servers are ReservedServers.
Check out this post!