Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 37 ยท Getting Started

Servers and Clients: A First Look

A beginner's first look at how Roblox runs one server and many clients, what gets replicated, which script types run where, and why important decisions belong on the server.

When you press Play in Studio, everything feels like one program. In a published experience it is not. Roblox runs one server (a computer in a Roblox data center) and many clients (each player's phone, console or PC) at the same time. Each holds its own copy of the world and they keep those copies in sync over the internet.

This lesson is a first look, enough to choose where to put your first scripts. The client-server model lesson later in the course goes much deeper into remotes and security.

Server and client

  • The server is the authority. It owns the true state: who has which items, whose health is zero, what the score is.
  • A client is one player's device. It draws the world, plays sounds, reads keyboard and touch input, and runs the interface.

Ten players means one server and ten clients.

flowchart TB
  S["Server<br/>true game state"]
  C1["Client: Ana<br/>draws, reads input"]
  C2["Client: Ben<br/>draws, reads input"]
  C3["Client: Cy<br/>draws, reads input"]
  S <--> C1
  S <--> C2
  S <--> C3

One server, many clients, all talking over the network.

Replication

Replication means sending changes from one machine to the others. By default it flows one way:

  • Server to clients. If a server script changes a part's color, every client sees it.
  • Client to server: not by default. If a client changes something, only that client sees it.

This is a security feature. Roblox has had Filtering Enabled permanently on for years, so a player who edits their own client cannot rewrite the server's world.

A client may still change its own copy for visual effects (a local particle, a screen shake). Things that matter to the game, such as damage, money and inventory, must be decided on the server.

Three kinds of script

Class Runs on Typical use
Script The server (by default) Game rules, spawning, awarding points
LocalScript One client Input, camera, UI, local effects
ModuleScript Wherever it is required Shared code

Where you place a script matters too. A Script runs in places the server owns, such as Workspace and ServerScriptService. A LocalScript runs inside a player's own containers, such as StarterPlayerScripts or StarterGui. The services lesson lists them all.

A request travels: click to coin

  1. The client notices a click on the shop button.
  2. It asks the server (using a RemoteEvent, covered later).
  3. The server checks the rules: enough coins? close enough?
  4. The server changes the truth.
  5. Replication carries the new state back, and the client updates the screen.

The client never says "I now have a sword." It says "please buy a sword," and the server decides. This is server authority.

Who does what

Server Owns the rules and the truth.
Client Draws the world, reads input.
Remotes Messages between the two.
Authority The server checks every request.

Never trust the client.

1 / 2

A stand-in: server authority

Real Roblox does the networking for you. This JavaScript stand-in is a model of the idea: the server owns the state, clients ask, and the server replicates the result.

JS Stand-in: server authority and replication (JavaScript)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Ana was denied (50 coins is not enough); Ben was allowed. Ana's edit of her own view did nothing to the server's coins.

Which side runs which job?

A second stand-in sorts features by the side that should own them. Add your own features to the list.

JS Stand-in: pick the right side (JavaScript)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Latency and trust

Messages take time to cross the internet (latency), so a client may see a slightly old state. For smooth movement, Roblox lets each player's client simulate their own character (network ownership). That is why movement is easy to exploit, and why numbers such as health and currency should live on the server.

A good habit: for every feature ask, "if a player's client lied about this, what could go wrong?"

Testing with several players

In Studio's Test tab you can start a local server with several local clients. Use it whenever your code involves more than one player; a single-player Play hides replication bugs.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which side owns the true state of a Roblox game?

    The server is the authority. Clients show and request; the server decides.
  2. 2. A client script sets a part's Color to red. Who sees red?

    Client changes are not replicated to the server or to other players.
  3. 3. Which script class normally handles keyboard input and UI?

    A LocalScript runs on a player's device, where input and interface live.
  4. 4. Why should purchases be decided on the server?

    A hacked client can claim anything. The server validates every request.

Summary

  • One server holds the truth; each player's client draws it and sends input.
  • Replication flows from server to clients; client-side changes stay local.
  • Script runs on the server, LocalScript on a client, ModuleScript where it is required.
  • Important decisions happen on the server; clients make requests.

Next: A Tour of the Studio Interface