Can too many attributes be a problem?

I am trying to rework my gun system right now however, I am worried about the huge amount of attributes I’m currently using for each tool.

Here’s the deal, I do not like to use modules to store my gun stats, so instead I use attributes. My gun system is complex and each gun can have about 20 attributes, all of them being stuff like stats and useful values.

Here is an example:
image

Also keep in mind I have optimized the system to avoid getting attributes too much (Hard to explain but what I am trying to say is that I am not getting attributes everytime a gun shoots.

The simple question is, can too many attributes be a problem in terms of performance/reliability?

1 Like

I personally don’t believe there’d be any issue with having a bunch of attributes but I wouldn’t take my word for it as I’ve never really used attributes.

What I will say though is that on the creator documentation it literally shows your use case as an example so I highly doubt it would pose any issues at all


Source: Instance Attributes | Roblox Creator Documentation

Personally though I use boolValues, object values, string values, etc inside a folder under a tool for stats because I find it easier to reference and change and stuff. Thats just personal preference however and I am unsure if it offers performance benefits.

Explicitly I haven’t heard that they are a problem but they probably are - make that definitely.

You can store these values in a ModuleScript which is parented to the gun.

The performance impact from using multiple attributes is likely in the same range as using a ModuleScript to store attributes, meaning you should just stick to what works for you.

In your case I would probably make a ModuleScript for certain weapon stats such as the price, spread, reload time, but keep attributes for anything input related like smoothness and intensity.

That just answered all of my questions, I think that i will probably stick to attributes for now.

Either way i have made a function that automatically loads all the gun’s attributes into a module just in case i decide to change later.

Thanks alot mate.

1 Like

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