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 4 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 4 years ago
Edited 4 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 — 4y
0
Yeah. RealTinCan 217 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 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:

local module = {
Damage = 50;
} -- end

return 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:

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

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

Humanoid:TakeDamage(ModuleName.Damage)

Did this help? Just tell me in the comments!

since i already know someone answered it before me ;(

Answer this question