I am yet again, confused by your logic. When I put this code with a Script in a Part:
script.Parent.Changed:Connect(print)
script.Parent.Name = "newname"
It outputs Name. I’m still confused what you’re trying to prove here.
I am yet again, confused by your logic. When I put this code with a Script in a Part:
script.Parent.Changed:Connect(print)
script.Parent.Name = "newname"
It outputs Name. I’m still confused what you’re trying to prove here.
It doesn’t work that way for Value Objects. It will fire for any other object. So connecting to a StringValue or NumberValue won’t fire.
I see that after testing. But, if you were to use Changed()
instead of GetPropertyChangedSignal()
, you would most likely also fire during .Parent
changes, if that were to happen. Everything aside, I find that GetPropertyChangedSignal()
is more effective at firing on single property changes.
All of that stuff aside, this should be your answer, OP:
PlayerV:GetPropertyChangedSignal(“Value”):Connect(function()
print(“IT CHANGED.”)
if PlayerV.Value == 1 then
print(“ya”)
Seat1:Sit(Player.Humanoid)
end
end)
Hope it helped!
Try it out in studio. Create two objects, a StringValue and a Folder (for example) and parent them to the player character. Then connect to them both with the .Changed()
event and see what fires when you rename them or re-parent them. The intellisense code also clearly states the .Changed()
will only fire for changes to the .Value
property only on the StringValue
or other Value Objects.
You’ve made some sort of point, confusing or not. I have no idea where you got intellisense from.
But, due to general preference when writing my code, I find that using GetPropertyChangedSignal()
is more efficient when trying to record changes on one property only.
Yes, I agree, but only for most parts. I would always use .Changed()
for Object Values because that’s the event designed to respond to changes to the value only. For everything else, you use :GetPropertyChangedSignal()
because that’s the intended event.
For example, you would use the .Enabled()
event on a tool to listen to when it changes, rather than connecting with :GetPropertyChangedSignal("Enabled"):Connect()
. But if you wanted to listen to when the TextureId
is changed you do use :GetPropertyChagnedSignal("TextureId"):Connect()
because there is not a specific event for that property.
What you said here made no sense. Enabled()
is not a property, but rather an event. But, what we both code is a matter of preference, and there’s no judging that.
Yes, it’s up to you, but I think you should use the events designed for a specific change rather than a generic one. That should clear everything up, we’ll have to see tomorrow if they have managed to fix the issue.
I already do use events like Enabled()
, since that is the proper way of using them. I only use GetPropertyChangedSignal()
for single property changes. But yeah, matter of preference. We’ll wait to see if he fixed it.
Thanks alot, i’ve tried it just now and it did work.