Adding a attribute to every part

Hey, I’m trying to add a boolean attribute to every part. I dont know if theres a way to do so however?
For more information, when I make a new part I want it to have a boolean attribute called “CanWallJump” and “CanGrabOnto”, so I can quickly check them to true.

1 Like

All instances come with a function for doing just that.

Instance:SetAttribute()

2 Likes

Do I do that with a script? Would it save in studio if I do that, and if not how do i get it to save?

1 Like

to get it to save i think you need to do it manually. Click on the object you want to add to then scroll all the way down on the properties window and theres a button that says Add attribute

2 Likes

When you say every part do you mean every part in the workspace?

You can do something like:

for i, part in ipairs(workspace:GetDescendants()) do
    if not part:IsA('BasePart') then continue end
    part:SetAttribute('CanWallJump', false)
    part:SetAttribute('CanGrabOnto', false)
end
1 Like

You could look into using CollectionService for this.
Here is a great plugin that lets you easily add tags to parts.

2 Likes

Yea, i meant every part in workspace. However, I would like to be able to easily change each part’s attribute inside studio itself.

That’ll set it to false for each base part (mesh parts, parts, trusses etc…) which I assume is the default so that should work. Paste it in the command line.

2 Likes