Scripting Helpers is winding down operations and is now read-only. More info→
Log in to vote

Do values not have a .Changed event?

Asked by
Wayyllon 170
3 years ago

I was anticipating on using a .Changed event to detect a Bool Value changing to true but it cant find a .Changed event inside of the Value?

And if there isn't, would there be a way around it? Wayyllon 170 — 3y

2 answers

Log in to vote
Answered by 3 years ago
Edited 3 years ago

To put it simply, yes, you can detect changes from a Boolean value.

There are multiple reasons why you could be having trouble detecting changes from a Boolean:

Are you changing the Boolean value from the client, and then trying to detect a change signal on the server?

If this is the case, then you need to rethink your method. Client changes will not replicate to the server.

Are you trying to detect change signals from the property or the actual object itself?

You should not try and detect a change signal from the actual value itself. For example:

This is the incorrect method, but quite common amongst new programmers.

game:GetService("ReplicatedStorage").BooleanValue.Value.Changed:Connect(function() end)

This is the correct method.

game:GetService("ReplicatedStorage").BooleanValue.Changed:Connect(function() end)

That should sum up your question. Also, have you heard of :GetPropertyChangeSignal(). It is extremely useful because you can specify exactly which property you would like listen for change signals on. In your case you could put the Value property inside of the parameters.

Boolean:GetPropertyChangeSignal("Value"):Connect(function() end)
Thanks, darmantinjr, I was having the second problem with trying to detect the change from the Value itself. Wayyllon 170 — 3y
No problem, the second problem is really common and I've ran into it my fair share of times as well. Now you know though. If this post did solve all of your questions, could you mark it as answered. This let's other members know that the question has been answered before they click on the post. It also gives me a couple of reputation points, which I am currently trying to gain. darmantinjr 169 — 3y
Sorry if I spammed your inbox there, I pressed post and it was not loading so I pressed it a few more times and apparently I posted the same thing 4 times haha. darmantinjr 169 — 3y
Log in to vote
Answered by
Benbebop 1049 Moderation Voter
3 years ago

Yes, only instances have a changed event. If you wish to listen for a specific property of an instance to change you will have to use GetPropertyChangedSignal.

Its quite simple so I wont go too in depth.


Replace <DesiredProperty> with the property you wish to listen to and Object with the object that has the property.

Answer this question