Hi, today I was working on my game when Value.Changed
wasn’t working. It has always worked before. Am I doing anything wrong?
Value.Changed:Connect(function()
--Code
end)
Hi, today I was working on my game when Value.Changed
wasn’t working. It has always worked before. Am I doing anything wrong?
Value.Changed:Connect(function()
--Code
end)
I believe you have to put
Value:Changed()
end)
Is this a local script or a server script, and how are you changing the value (through a script or through the properties tab)? You did format it correctly so it should be working.
No, the way the OP typed it is correct
Its a server script, and I am changing the value through a server script
That doesn’t make any sense whatsoever. Value.Changed
is an RBXScriptSignal, not a function.
Could you add a while loop right below the changed function to check if it is registering the change.
Value.Changed:Connect(function()
--Code
end)
while wait() do
print(Value.Value)
end
How did you define the variable?
local Value = --Path to value
Did you try what I said to see if it recognizes the change. Also are there any errors in the output?
I am trying that right that right now, it has not shown any errors yet
I guess you do this:
Value:GetPropertyChangedSignal("Value"):Connect(function()
end)
I don’t see how it’s any different though from the original way though
I tried it, and I set the value to 5 via script, and it is still showing up as 0
There is no point in doing that since ValueBase
objects already use modified Changed
events that only fire when Value
property changes.
I just thought of that and edited my post.
Make sure the function is connected to the actual value object and not the value of the object.
I feel like my Roblox Studio is just being buggy right now
Question, which valuebase object are you using?
I am currently using a numbervalue
Okay and where is this script located that contains the code to connect a function to Changed
event and what kind of script is it?