Do ModuleScripts run its functions inside the script it calls or does it run as a separate thing?

It’s more like a question rather than asking for help. As the title asks, I’m wondering if ModuleScript functions run inside its own thing or if they run inside of the scripts that call them.

If so, if you disable a script, would it stop the ModuleScripts running functions inside of it too?

it run as a seprate thing but once you put the return statement and whatever object come next will go to the variable (not only variable it can be function to) like :

module:

local module {}
module:func()
    return "Yes this is a text"
end
return mdoule

script:

local this = require(module)
 local string = this:func()  ---now its string is Yes this is a text

I see, so is there a way for the script to call a function from a modulescript so that it can run it in itself?

Actually nevermind, I’m dumb. I didn’t test it properly. It does run inside the basescript so when you disable the script, so it does stop the function inside modulescript from running when disabled.

Hm, so if a function in a modulescript contained a wait function and the basescript was to be disabled, would that stop it before it executed the code after the wait(x)?

Yeah, it would if the function was called from that basescript.

1 Like