Yes, I know GetPropertyOnChangedSignal exists but I want to check if any property is changed, since this only checks 1 property is changed, how to do this?
You can use:
local StringValue = script.StringValue
String.Changed:Connect(function()
-- Your code here
end)
But how do I detect which property is changed?
It has an argument of the property here
local part= Instance.new("Part")
part.Changed:Connect(function(p)
print(p)
-- Your code here
end)
I believe that just only returns the value of the property, I think Iâm wrong
No it returns the name of the property that changed
ok thx!!!
For a StringValue instance, its â.Changedâ event only fires when its Value
property changes, the RBXScriptSignalâs parameter represents the new value of that property, i.e;
local stringValue = workspace.StringValue
stringValue.Changed:Connect(function(string)
print(string)
end)
stringValue.Value = "Hello world!" --Event fires and "Hello world!" is printed.
stringValue.Name = "StringInstance" --Event doesn't fire.
For all other types of instances, their â.Changedâ RBXScriptSignal object will fire whenever the value of any of their properties is changed, with the parameter being the name of that property as a string type value, i.e:
local part = workspace.Part
part.Changed:Connect(function(property)
print(property)
end)
part.Name = "Test" --Event is fired and "Name" is printed.
part.Parent = nil --Event is fired and "Parent" is printed.
i was putting string value as an example. It doesnât have to be a string value
Well your example would only work if the StringValueâs Value
property is changed. The threadâs poster was looking for a way to detect if the value of any of an instances properties is changed.