I am unable to require a module twice from the same script, how may I achieve it?
while wait(10) do
require(12345)
end
Thank you if you know the solution. It only gets required once.
I am unable to require a module twice from the same script, how may I achieve it?
while wait(10) do
require(12345)
end
Thank you if you know the solution. It only gets required once.
require
caches its result. But why do you want to do this? Can’t you return a function and call that multiple times?
I wanted to run some code in my game without having to reboot the servers, so I could just update the module to run the code. Or is there a more efficient (or possible) way to do this?
(Thank you) I tried:
while wait(10) do
local Module = require(12345)
Module()
end
It worked, however when I update the module it does not get updated live in my game.
Yes, it is possible, but you’ll have to get the ModuleScript
via InsertService:LoadAssetVersion()
,
as both require()
and InsertService:LoadAsset()
cache the initial data. You can repeatedly
Clone()
a wrapper ModuleScript
and parent it so as to be able to use require()
on it, if that
floats your boat.