I made a game that has a value, and a text. The text is the value but when the value updates (grows), the text still says 0 value. Please help me.
script.Parent.Text = script.Parent.Value.Value.. " Parts"
I made a game that has a value, and a text. The text is the value but when the value updates (grows), the text still says 0 value. Please help me.
script.Parent.Text = script.Parent.Value.Value.. " Parts"
Do a GetPropertyChangedSignal function to get it to update
function onChanged()
script.Parent.Text = script.Parent.Value.Value.." Parts"
end
script.Parent.Value:GetPropertyChangedSignal("Value"):Connect(onChanged)
Hey there. This would only be called once in the script as there is no event or function connected to it to let the script know when to execute the command again.
Some suggestions are:
Using a while wait() do loop
It comes with its own pre-cautions as it's simple to do but will cause lag in the long run
Using a GetPropertyChangedSignal
This event detects whenever a value is changed and can be connected to a function which would allow you to change your text value
script.Parent.Value:GetPropertyCHangedSignal("Value"):Connect(function()
script.Parent.Text = script.Parent.Value.Value.." Parts" <-- and then this just goes underneath and skadoosh
Nether of those work, I am sure I used the while wait() do correct but the GetPropertyChangedSignal I am not sure I did it right, thankyou
This is simple to solve you've forgotten to add a I'm also assuming that your using a Int value
local value = script.Parent.Value.Value.. " Parts"
value.Changed:Connect(function()
--so basically what does value.Changed:Connect(function() do it does if the value changes then
--we will do a function
you should also put the value in the RepilcatedStorage
So this is the final script
local value = game.RepilcatedStorage.Value
value.Changed:Connect(function()
script.Parent.Text = value.Value
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
sorry, I'm late, this was a long time ago when I first learnt scripting.