I’m wanting to find out the amount of attributes that they’re on an Instance and I’ve used #Instance:GetAttributes() for this but when I do it will always be 0 for some reason when there’s multiple attributes. Is this a Roblox bug or is there something I’m not doing right or? I’ve tested #Instance:GetChildren() and that worked fine but for some reason #GetAttributes() is always 0.
One way to get around this is to just do the following code, but I’d prefer to just go #GetAttributes() instead of having to create a loop that does the same thing.
local Number = 0
local Folder = game.ServerStorage.Folder:GetAttributes()
for i, v in Folder do
Number += 1
end
print(Number)
So is this a bug or an intended thing? If its a bug then could someone please report this bug in the #bug-reports category as I don’t have access to it right now.
GetAttributes() returns a dictionary, and the length operator only works properly on sequential arrays.
I’ve seen a freature request for a function that counts elements of dictionaries and mixed tables as part of the table library. Perhaps it will get implemented in the future.