GSmGpE6CwX2y9JjB25B8
We use cookies on this site to enhance your user experience

Client and Server-Side Scripting

Client and Server-Side Scripting

Aug 29 2019, 9:27 AM PST 2 min

The server can be thought of as the version of the game running on the computers at Roblox. Its job is to keep track of everything, and make sure that all the clients are synchronized. Server-side Scripts run only on the computer at Roblox.

The client is the software that you and other players run on the computer in order to play the game. Client-side LocalScripts run on every player’s computer.

Servers

Servers.JPG
Servers hold the data that the clients need. Using servers, data can be transferred from one client to the all the others. Server-side scripting affects the server. The server sends data to the clients, so if the data is affected, so are the clients. Parts are groups of data, so if a server-side script adds a part to the server, the part will be visible to all the clients. Most scripts are server-side so players can interact with each other; it is an online hangout. To create server-side scripts, you must insert the object “Script.” Server-side scripts do not run in StarterGui or StarterGear. This can be used as an advantage, so that the scripts will only run once it is copied into a new player’s Backpack or PlayerGui. You have probably been using mainly server-side scripts in your scripting journey so far.

Example

Creating a Simple Server Script

  1. Go to Studio and create a new document. (Ctrl+N)
  2. Create a baseplate large enough for players to walk on. (Remember to anchor it.)
  3. In the toolbar, go to Insert>Object>Script.
  4. Open up the script.
  5. In the script, create a Part and make it change colors like so:
x = Instance.new("Part",game.workspace)

while true do
	x.BrickColor = BrickColor.Random()
	wait(3)
end

Testing the Server Script

  1. Now that you have your script created, start a server. Go to Tools>Test>Start Server.
  2. A new window should open up. This is the server. Now, players must be added to the server.
  3. From the server window, go to Tools>Test>Start Server.
  4. Another window should open up. This window is the view of the player that was created.
Tags:
  • client
  • server
  • concept