v.0.5, June 26th
– fixed instance leaking
– optimized script
Hello there! Ever had trouble storing values into objects easily? Wanted a part to have a hidden name/value?
Well, look no further! Attributez is here to solve your problems!
What's a attribute?
“a quality or feature regarded as a characteristic or inherent part of someone or something.”
basically, a value assigned to an object.
Why use Attributez instead of CollectionService?
Because CollectionService can only tag things, and cannot store values in tags.
IMPORTANT: Attributez will only work in-game, as it is a module.(unlike CollectionService)
I tried to use attributes but it wasn’t released yet so it failed miserably
end of story
First, you will need to get the module from the link below.
Then, move it into
(in this example I’ll put in the ServerScriptService, but you can put it wherever you like)
Now, there are 3 functions that are included in this module:
:SetAttribute(instance,attribute,value) -- the instance (eg. a part), the name of the attribute (eg. HiddenName), and the value of the attribute (eg. "Extra Cool Part" ) --// returns nothing :GetAttribute(instance,attribute) -- the instance, and the attribute --// returns the specified attribute, will return nil if not found :GetAttributes(instance) -- the instance --// returns a table of attributes, and it's respective values
Say, we wanted a part to have a “hidden name”. We would first,
require the module.
local ServerScriptService = game:GetService("ServerScriptService") -- gets the server script service local Attributez = require(ServerScriptService:WaitForChild("Attributez")) -- replace with the path to where you put the module -- (P.S wait for child reduces the risk of your module(s) not loading properly.)
Then, we would identify our part, and use the command
:SetAttribute() to give it a hidden name!
local Part = Instance.new("Part",workspace) -- your part Attributez:SetAttribute(Part,"HiddenName","I'm actually a banana")
In order to get our hidden name from the part, we would use
local partHiddenName = Attributez:GetAttribute(Part,"HiddenName") print(partHiddenName) -- "I'm actually a banana"
If we wanted to get ALL the attributes from the part, then we would use
local partAttributez = Attributez:GetAttributes(Part) print(partAttributez.HiddenName) -- I'm actually a banana
That’s about it! Feedback is greatly appreciated. Good day!