Hello, I need help. Can someone specify how does a value changed script work? I could only do this, and wont work:
Could you perhaps give any error messages so we can help you with your problem.
I cannot tell any since it gives no errors, honestly.
Please do not take pictures of code. Please copy and paste it into a code block next time. With that aside, I would use Instance:GetPropertyChangedSignal.
Is there any way the script to run when the change is madr?
Please take a look at the link I gave you.
Your code is rather messy. The .Changed event works like this:
local ValueInstance = ... --//typeof(ValueInstance) == "Instance"
ValueInstance.Changed:Connect(function(value)
script.Parent.Text = string.format("Value: %s", tostring(value))
end)
I would use Instance:GetPropertyChangedSignal() instead.
The link was rather confusing to me, to be honest. I don’t know a lot of scripting.
Someone please explain over what to do all I tried is confusing and leads to nowhere for me. ![]()
Do you have any experience with programming?
No, I barely know anything, I only know basic commands…
An end is expected to close a function, you left that out for the function Value.
It is also better to use different names for variables when required, to improve readability and help debugging.
try this
local ValueObject = script.Parent.Value -- ValueBase object
local function OnChanged(newValue)
print(newValue)
script.Parent.Text = "Value: " .. newValue
end
ValueObject.Changed:Connect(OnChanged)
Okay, I will be adapting it over. Will be telling results…
It worked, thanks. Finally I can do it function.
