More Instances but less scripts or more scripts but less instances?

I’m currently making a system that I want to be largely automated, but I’m wondering which of the two options im thinking of would be better for the sake of performance. Do I:

Have a master script that uses workspace:GetDescendants and workspace.DescendantAdded too check for any ThingDoer folders and set them up to do whatever
image
image

Or do I put a script that requires a modulescript in everything I want to do the thing.
image

I’m just not entirely sure how much memory a large number of scripts would use versus a large number of value instances, and if listening for DescendantAdded would make performance take a major hit.

2 Likes

Since you didn’t explain the specific system you’re trying to make, i’ll have to talk general here:

It’s generally better to use module scripts over value instances. A ModuleScript that returns a table of values uses less memory than a folder of values. Also using one master script that uses workspace:GetDescendants() will have to loop through a large number of instances, which is slower than just using module scripts.

Although not officially stated, Value instances (NumberValue, BoolValue etc), BindableEvents and BindableFunctions, are quite outdated and ModuleScripts should be used instead.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.