Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is this an efficient way to use module scripts in single script architecture?

Asked by 5 years ago

Here is my main script:

spawn(function() -- part of the main script anyway

    for i,v in pairs(game.Workspace.Tycoons:GetChildren()) do

        if v:IsA("Model") then

            savedTycoonsTable[v.Name] = v:Clone()

            local runTycoonDoor = require(moduleScripts.RunTycoonDoor)

            runTycoonDoor(v)

        end
    end

    require(moduleScripts.BoxDroppingScript)
    require(moduleScripts.DataSavingLoop)

end)

Here is some of what is inside the module BoxDroppingScript:

spawn(function()

    while wait(loopWaitTime) do -- may want to change this wait time

        randomBoxSelectorAndCreator()

    end

end)

return true

I had to spawn the loop in order that the module would return true in both module scripts. Is that the best way to go about single script architecture or is there a better and more efficient way? Hope you guys can help. Thanks!

1 answer

Log in to vote
0
Answered by 5 years ago

It maybe, however I've heard that some people where having problems with that with Filter Enabling.

Ad

Answer this question