Make everything with the name Whatever it is.."Equipped" turn false


if dna:WaitForChild(SELECTED.."Owned").Value == true and dna:WaitForChild(SELECTED.."Equipped").Value == false then
		RS:WaitForChild(SELECTED).Settings.Boost.Value = Select.Parent:WaitForChild("Max").Value
		
		for _, v in pairs(dna:GetChildren()) do
			
				dna:WaitForChild(SELECTED.."Equipped").Value = true
				
			
		end

How do I make it so everything else that is true and has the word “Equipped” in it turn false?

You could do this:

YourInstance:SetAttribute("Equipped", false)

But, if YourInstance.Equipped does not exist, it will error. So, do this:

pcall(YourInstance:SetAttribute, "Equipped", false)

The code above will set the attribute. But if it errors, it will move on.

its saying Attributes are not currently enabled

Oh, ok…

pcall(function ()
    YourInstance.Equipped = false
end)

Edit: In the future, when the SetAttribute feature get fixed (it might now), use the code from before.

I dont need an exact instance. I want all the children with the name


dna:WaitForChild(WHATEVER.."Equipped".Value) = false

I don't know what to do for WHATEVER

This is a syntax error because namecalls cannot be by itself without calling it.


To OP:
What do you mean by has the word “Equipped” in it turned false? The property? The name?
And what do you mean by “everything else”?
If you mean if it has "Equipped" in the name, simply check if it has the term "Equppied" using string.find

for _, v in ipairs(dna:GetChildren()) do
    if v.Name:find("Equipped") then
        v.Value = false
    end
end
1 Like

Thank you it worked :smiley: (30 chaaaaaaaars

I think I know what you mean:

for index, value in pairs(dna:GetChildren()) do
    if value:FindFirstChild("Equipped") then
        value.Value = false
    end
end

Edit: Lol, I was a little late :laughing: