Hello,
I am wondering when :GetPropertyChangedSignal()
is fired that if there is a way to tell what the value was changed from, the original value before it was fired, was. I don’t see any parameters for it might there be a method of some sort?
It would be saving the previous value
local OldValue = nil
Instance:GetPropertyChangedSignal(Property):Connect(function()
OldValue = Instance[Property]
end)
This but I think you meant to assign OldValue
to Instance[Property]
otherwise you’d just be overriding the old value.
How? I did not understand what you want to say, just had to replace Property
by the property that is needed, example with Color
and Part
local OldValue = nil
Part:GetPropertyChangedSignal("Color"):Connect(function()
OldValue = Part.Color
end)
I think you confused this with a dictionary, and yes you can do Instance["Color"]
or with another property and it would give an error if it were an invalid property, if not, correct me.
What’s the point in storing the old value if you’re going to override it though? Usually when you store an old value you intend to use it for some purpose, that was all I was getting at. I’m not confused at all, why do you feel the need to resort to such opinionated attacks?
local OldValue = Part.Color
Part:GetPropertyChangedSignal("Color"):Connect(function()
Part.Color = OldValue
end)
See the above logic? That’s a potential useful benefit of storing an older value of something.
It does not cancel it, the author of the post wanted to know what the previous value was, not change it and yes, the original property of the Instance could be saved instead of putting nil
, perhaps the author wanted to compare the previous value.
Sorry? I was not attacking you, I just asked what you wanted to say and if you thought it was a dictionary, if not you should only correct me.
Also sorry @Icey_CD for reviving the publication with this.
Yes this is correct. I just want to compare the 2 values when it is fired.
You’re still not doing anything with that old value in your example, is all. That includes not comparing it.
Well, the author only asked for help with that, I had nothing else to do with the code.
Sorry, I tested but not get the oldValue (previo value before the new value is put en the instance’s value). The value getted is the new value.