We are making map for our game, and would like some visual effects to be controled by scripts stored in the map. Is it possible to run these scripts within the map, after cloning the map from ReplicatedStorage to the workspace?
Thanks.
We are making map for our game, and would like some visual effects to be controled by scripts stored in the map. Is it possible to run these scripts within the map, after cloning the map from ReplicatedStorage to the workspace?
Thanks.
You should store them in ServerStorage to prevent the stored scripts running in ReplicatedStorage.
I’m pretty sure that, if you enable a script, after it was disabled., it will instantly run. So, what you could do is:
Loop through all of the descendants of the map, check if it is a LuaSourceContainer, and if it is, then disable it.
After that, once you wanna clone it to workspace, you will do the same thing, but with extra notes:
Of course, parent the map to workspace (More likely by doing it on a clone.), and, instead of disabling, enable all LuaSourceContainers.
A little side note: ModuleScripts don’t have a Enabled property, meaning if you have one as a descendant of the map, you’ll have to check if it is a module script, otherwise using .Disabled on it won’t work.