Beginners Scripting Guide (BETA)
  • Getting Started
  • Basic Data Types
  • Variables
  • Basic global functions
  • Number Arithmetic & Compounds Assignment
  • If statement
  • Function
  • Table & Dictionary
  • Loops
  • Creating An Object
  • Understanding Client & Server
  • RemoteEvent
  • Unfinished & In-progress
    • Methods
    • RemoteFunction
    • Basic libraries
    • Basic Services
    • Basic of Vector3 and CFrame
    • Basic built-in events
Powered by GitBook
On this page
  • PLACEMENT OF CLIENT AND SERVER SCRIPT
  • WHERE CAN A CLIENT SCRIPT (AKA LOCALSCRIPT) RUN?
  • WHERE CAN A SERVER SCRIPT (AKA SCRIPT) RUN?
  • HOW CLIENT AND SERVER WORKS?
  • Scenario 1:
  • Scenario 2:
  • Scenario 3:

Understanding Client & Server

✏ Beginners Scripting Guide ✏

In this section, we'll discuss how client and server works. The server is the game and the client is the player.

PLACEMENT OF CLIENT AND SERVER SCRIPT

In this section, you will be learning how to put script in the correct place so that the script can run when you play the game.

WHERE CAN A CLIENT SCRIPT (AKA LOCALSCRIPT) RUN?

Client script can be running in StarterGui, StarterPack, StarterCharacterScripts, StarterPlayerScripts, and ReplicatedFirst. If you place client script everywhere else other than these places above then the client script will be fail to run because those are not it places.

WHERE CAN A SERVER SCRIPT (AKA SCRIPT) RUN?

A server script can be place in workspace, ServerScriptService, StarterGui, and StarterCharacterScripts.

HOW CLIENT AND SERVER WORKS?

In this section, you will be learning how is the server and client works in Roblox. The server and client can be communicate to each other by using RemoteEvent and RemoteFunction to send data to each other which you will learn on RemoteEvent and RemoteFunction section. When there is a change on server, both the client and server can see that chance because since the server will apply that change to the game and every players in the game. But, when there is a change on client. The server cannot read the client change and only the client can read the change on the client because when there is a change on client the change will be only apply to the player.

Scenario 1:

Let's say I create a part on server in a script. I can still access the part from client and server because the part will be visible for the game and every players.

Scenario 2:

Now, let's say I create a part on client and I try to access it from the server. But, when I tried to access it from the server. The server said it was not exist for some reason. Well, that is because the part is only create for that client only and not for the game so the game will not have the part since it was only create for that certain client.

Scenario 3:

Let's say you have a game where a player activates a power-up. When activated, you want the power-up to have a delay of 3 seconds before it takes effect on the server. You decide to handle this delay on the client side and then notify the server to apply the power-up effect. However, the server does not apply the effect as expected. Why? It is because when you yielding on the client, it doesn't affect the timing or execution on the server. This can lead to synchronization issues where the server is not aware of the client's delay, and thus the intended action does not occur on the server.

PreviousCreating An ObjectNextRemoteEvent

Last updated 11 months ago