Im looking to create a stats system based on what the player has equipped. The player will be swapping gear out pretty regularly in my project, so whats the best way to handle this?
I tend to use attributes with tables inside of them using HttpService:JSONEncode()
. It’s a simpler method and allows for cleanliness and less use of unnecessary values. This is only for complicated things though, like accessories on the tool and such.
For stats like Damage, Cooldown, etc. you can just use the Configuration
Instance. It works just like a folder but with a new icon making it more obvious that it handles stats. I usually keep all stat attributes in it making them easier to access.
Although, you can also use Module Scripts if you want to use one stats script everywhere.
Personally, I would keep a module with a table of all the weapons and their stats, and also a base set of stats for the player in case any of the stats changes things like walkspeed or jumpheight.
Anytime the player equips the weapon, just access the module and change the stats accordingly.
Like @iicloudsforeveriii has mentioned, you can also use attributes for the same. Hope this helped!
(This is my first post lol)