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

How to get the Changed event to fire when a Values Name changes?

Asked by
SirNoobly 165
9 years ago

Basically what I want is to get the Name of the IntValue if it's changed. For some weird reason the Changed event for a Value only works for its Value property, so you can't tell if its Parent or Name has changed.

Better Example:

local thing = Instance.new("IntValue", workspace)

thing.Changed:connect(function(property)
    print(property)
end)

wait(1)
thing.Name = "Fish" -- doesn't print anything
thing.Value = 8 -- prints 8 because it's the value
0
does it print changed?? NinjoOnline 1146 — 9y
0
Nope SirNoobly 165 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago
local thing = workspace:WaitForChild("IntValue")

thing.Changed:connect(function(value)
    print("changed")
end)

thing.Name = "Eh" -- This will change the IntValue's name, it will not print in output.

The one you want The one your using You need to change if you want it do when a propert is changed Your question is a bit confusing, maybe add some more detail, like do you want the IntValue's name to change Eh if the value has been changed?

If this helped please accept and rate up, but if this dosen't work, they don't hate, just ask and I can help with more details.

- NinjoOnline

0
I honestly don't understand why ROBLOX have 2 changed events, though. They could've easily named this one ValueChanged or something. Spongocardo 1991 — 9y
0
^ IKR, confusing NinjoOnline 1146 — 9y
0
Sorry I mean't that "changed" doesn't print when I change the name of the IntValue, only when I change the Value. Yeah your right there should only be one Changed I don't see the point of another. SirNoobly 165 — 9y
0
yeah thats what changed does, if the Value is changed and not the name NinjoOnline 1146 — 9y
View all comments (6 more)
0
Changed fires when any property of the Instance changes, but just not for values. SirNoobly 165 — 9y
0
answer editted NinjoOnline 1146 — 9y
0
I find it odd how values have 2 changed events. You can't distinguish one from the other, but the Changed event for Instances is available to all values. Check this if you're confused: http://wiki.roblox.com/index.php?title=API:Class/Vector3Value Spongocardo 1991 — 9y
0
Nope, there's no way to choose between whether I want the Changed Event for values or Instances, I get one or the other. You try and use the Changed event on a Value Instance and get it to fire when a property other than the Value changes. SirNoobly 165 — 9y
0
Please use good grammar when answering! It's hard to understand when it's all one big run-on sentence! Perci1 4988 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

.Changed certainly does work with changing the name of objects. My guess is that your issue lies here:

local thing = workspace:WaitForChild("IntValue")

Are you sure there is a value directly in the workspace named "IntValue", and it's not grouped with any models? Your code will wait until there is an object named IntValue directly in the workspace, and won't continue until it finds it. If it's never added, that code is going to loop there forever and ever. The rest of the code works 100% fine -- just make sure there is an object in the workspace (directly in it -- not grouped with any models) named "IntValue".

0
It's just an example. Try it out. SirNoobly 165 — 9y

Answer this question