Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Are ModuleScripts server-sided or client-sided?

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

✓ Accepted answer

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. :)

2 comments

0

So I would be able to access ServerStorage if I required it from a ServerScript?

0

Yeah.

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 ;(

This discussion is preserved as it was. New answers, comments, and votes are closed.