#Module runs multiple times when required multiple times

1 messages · Page 1 of 1 (latest)

wintry prairie
#

I don't know why it prints {} and {...}. isnt a module supposed to run once and display everything the same like all things inside DataManager template should be the same across everywhere?

jolly night
jolly night
#

you aren't supposed to put code in a module script because it runs every time you require it

#

you can if you want but it's not recommended

#

think of a module script like a function, whenever you require it, its like running a function

wintry prairie
jolly night
#

nope

#

every time you require it, it runs again in a different environment. tables in the module script will also vary per require

quaint citrus
jolly night
#

try it yourself

#

wait what

#

it only works in very specific cases

quaint citrus
odd flameBOT
#

studio** You are now Level 1! **studio

jolly night
quaint citrus
#

it only outputs a single time

jolly night
quaint citrus
#

now that's strange.

#

in my studio it only outputs a single time

jolly night
#

i have no idea whats happening

#

modulescripts are very weird

quaint citrus
#

Imma see if I can see something related to this bug, because module script are supposed to only ran once

quaint citrus
quaint citrus
#

I mean test in game

#

not in studio