Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Are module scirpts local or server sided?

Asked by 5 years ago

2 scenarios:

  1. A local script calls the function inside the module script. Is that function local or server?
  2. A local script sends a remoteevent to a server script, server script calls the function inside the module script, server or local?
0
scirpts TheluaBanana 946 — 5y
0
It depends on the type of script that is requiring it. ModuleScripts adopt the script type of the requiring script, so that means you can call LocalScript-only paths (like LocalPlayer) if required by a LocalScript. You can access the ServerStorage and ServerScriptService if required by a Server Script. Fifkee 2017 — 5y
0
ModuleScripts inherit the context level of the script that requires them metryy 306 — 5y

3 answers

Log in to vote
1
Answered by
amanda 1059 Moderation Voter
5 years ago

ModuleScripts have no side in the Client-Server model by default, they run inside the context that they are required in.

Whenever you require a ModuleScript, you should imagine it being run inline in that very location.

With this in mind, if you plan on only requiring a ModuleScript from a LocalScript, you could use Client-side services like UserInputService within your ModuleScript. Similarly, if you only require a ModuleScript from a Script, you would be able to manipulate objects within ServerStorage from your ModuleScript.

However, some people create Utility Modules that can be required by both a Client and the Server. This is achieved by the ModuleScript being located in ReplicatedStorage, and also it not containing any code that is side specific.

Ad
Log in to vote
0
Answered by 5 years ago

dey are two - sided

dem backstabbing swines

Log in to vote
0
Answered by 5 years ago

They are both sided, though, if I remember correctly, if you changed data of a module script on a server script, it won't replicate to the client, meaning the changes won't apply to the client.Same thing for the client, if a module script is changed on the client, it will stay the same on the server side

Answer this question