When something is replicated, what you refer to as ‘showing’, the server has to use resources to send a network packet to the client(s) that contains information about the data that is being replicated, so that the client can display it on its locally running instance of Roblox.
Things can be replicated to everyone or a specific player, and clients can also send data (replicate) to the server, but the server would authenticate whether it will actually do what the client requested. The general rule is this: The server is always right and never trusts anything sent from the client. When you start to trust the client you are also trusting anything malicious and your game will be exploited.
In terms of performance, the server can only do one thing at a time. You do not want to be wasting the server’s time by replicating things uselessly or too much that you don’t need to. This will cause the server to appear to ‘lag’ for players in the server because the server will begin to replicate slower and slower to clients as it has too much work to do.
Want you usually want to do is offload some of this work to clients whenever possible. Work that is done on the server can contribute to everyone lagging, but work that is done on a client will only ever affect themselves.
A good rule of thumb is:
- Try and do work on the client whenever possible
with an exception for
- Data that needs to be validated, in which the server must do
- Data that all players must know of can be done/stored on the server
An example of something that would only be done on the client and not ever sent to the server is advanced gun effects. Other players do not need to be aware of bullet casings ejecting or detailed sway animations for your gun. Some games even have low-detailed gun models for everyone except yourself. Visual effects for the most part can be done on the client (with low-detailed versions for others).
An example of something that would only be done on the server is player hit detection and damage. The client would tell the server it has shot their weapon, but its up to the server to validate whether or not that resulted in a legit hit (whether they can shoot that fast, shoot in that direction, or if they even have any ammo left, etc)
Movement is special and is actually generally done on the client, replicated to the server, and the server will 100% trust them. This is how Roblox handles player movement (which is why teleporting exploits work). This is the only way to do player movement that is not laggy. If the server was to validate player movement, you would have an input delay proportional to your ping and server lag. For example, if you had 2000 ping it would take you 2 seconds to start moving after pressing W. That’s no good.
To prevent movement exploits, the server will validate movement after it has happened. A simplified example of an exchange that could happen:
(client is at position (0, 1, 0) and teleports with an exploit)
Client: I am moving to position (1000, 1, 250)
Server: Okay! I will let everyone else know.
(a tiny bit of time later)
Server: Wait a second, you were just at position (0, 1, 0), it’s impossible for you to move there that fast!
(server teleports the player back to where they were before)
Hopefully this explanation and info helps!