Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to make an updated text?

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"

3 answers

✓ Accepted answer

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)

1 comment

0

sorry, I'm late, this was a long time ago when I first learnt scripting.

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

3 comments

0

script.Parent.Value:GetPropertyCHangedSignal("Value"):Connect(function()

0

script.Parent.Text = script.Parent.Value.Value.." Parts" <-- and then this just goes underneath and skadoosh

0

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.