Why doesn't GetAttributeChangedSignal work?

Problem
Anyone could give my info to why this isn’t working?
I change enabled from true to false manually, since I
just wanted to test it out quickly, but I’m not seeing any prints or errors.

Enabled is a boolvalue and it is a attribute.

Code (Local Script)

script.Switch:GetAttributeChangedSignal("Enabled"):Connect(function()
	print("Hello my property has changed")
end)

Question
Is it because it’s in a local script and how would I be able to make it work in a local script?

So what is “Enabled”? Is it a boolvalue or an attribute? It can’t be both :laughing:

Well when I added an attribute to switch I made it a boolvalue, the name for it is called Enabled.

Im assuming your instance is the className bool value so you could try these other two ways :

script.Switch:GetPropertyChangedSignal("Enabled"):Connect(function() 	
    print("Hello my property has changed") 
end)

or just

script.Switch.Changed:Connect(function() 	
    print("Hello my property has changed") 
end)

So your looking to detect when the attribute changes and the attribute is in a boolvalue called Enabled?

The user is looking to find when an attribute is changed not a property. Enabled is not even a property of a boolvalue so it is clear it is not a property.

Yeah, but it’s not working. I’m not getting any prints or errors. I do the changes manually by going into properties and checking/unchecking the box for the attribute

I’ve tried .changed and it doesn’t work either

What is your local script parented to? You may be looking at the wrong instance.

I figured out why it wasn’t working, it was because I had a loop above it. I’m sooo sorry for everyone commenting :sweat_smile:

1 Like

No, just a horrible mistake on my part. :sob:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.