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

Are ModuleScripts server-sided or client-sided?

Asked by 5 years ago

As in the title, I was wondering if ModuleScripts run on the server or run on the client, so I can know what I'm able to access.

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Basically, ModuleScripts inherit where they were called from. Meaning if you were to require it from a ServerScript then it would act as a ServerScript. And if you were to require it from a LocalScript then it would act as a LocalScript.

Please mark this as answered if it helped you. :)

0
So I would be able to access ServerStorage if I required it from a ServerScript? RoButCantBlox 68 — 5y
0
Yeah. RealTinCan 217 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Technically, they're neither, given the information I got from devrbxpage/ModuleScript, it's more like a printer.

Say if you're making settings for a tool and you wanted to add the setting "Damage". You can do:

1local module = {
2Damage = 50;
3} -- end
4 
5return module

and it gives out all the information wanted and needed. If you wanted to use it for another script (local or server), you can identify the module's settings/values by putting:

1local module = require(script.Parent:FindFirstChild("ModuleName")

then you execute the damaging part. (Assuming you got the player's humanoid you need to damage)

1Humanoid:TakeDamage(ModuleName.Damage)

Did this help? Just tell me in the comments!

since i already know someone answered it before me ;(

Answer this question