BetterAttributes
An OOP-Styled attribute controller for whatever your needs are
BetterAttributes is a ModuleScript designed to help developers use the current Attributes system in an easier way than before using simple OOP-styled way in a way it was not used before.
Example;
local BA = require(script.BetterAttributes)
local Atts = BA.Focus(script.Parent) -- Get the attributes from the parent of the script.
-- let's say the parent already has some attributes like 'Key1' (= "Val1") and 'Key2' (= "Val2")
print(Atts.Key1); --> "Val1"
Atts.Key1 = "NewVal1";
print(Atts.Key1); --> "NewVal1"
print(Atts.Key2); --> "Val2"
Atts.New("Key3","Huh"); -- Make sure the script will start listening to Key3 so it won't be nil later.
Atts.Key3 = Atts.Get(Atts.Key2); -- The .Get() part is optional, but will decrease the chance of a nil if such attribute exists but the script didn't listen to it.
API Docs, shown as an example (again);
local BetterAttributes = require(script.BetterAttributes);
local Attributes = BetterAttributes.Focus(script.Parent);
Attributes.Get("Attribute") --> instance:GetAttribute("Attribute") [Not being listened to]
Attributes.New("Attribute", 0) --> instance:SetAttribute("Attribute",0)
Attributes.Get("Attribute") --> 0 [Listened to]
Attributes.Attribute --> 0
Attributes.Attribute = 1 --> instance:SetAttribute("Attribute",1)
The Script:
You can get the modulescript directly from this link.
Alternatively, you can do local Attributes = require(7390744226).Focus(inst)
to get the same result.