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

How do I make text update based off a Value's value?

Asked by 5 years ago

I'm trying to get some Text to change whenever a Value is changed. So far I have this but it doesn't work.

01local Text = script.Parent.Text
02local Title = script.Title.Value
03 
04local function updateText()
05 
06    Text = Title
07 
08end
09 
10status.Changed:Connect(updateText)
11updateText()

1 answer

Log in to vote
0
Answered by
Uluomis 32
5 years ago

The code below is a better and shorter way to do functions based on things such as .Changed or .Touched or .MouseButton1Click, and etc. I've labeled parts of the script that tell you what it does. Hope this helped!

1local textLable = script.Parent --Makes a variable for the text
2local title = text.Title -- Makes a variable for the Title/Value
3 
4textLable.Text = title.Value -- Sets the text to the value when the script is first ran
5 
6title.Changed:Connect(function() -- Detects when the titles value changes
7    textLable.Text = title.Value -- Sets the text to the value
8end) -- Ends the function
0
Sorry, it appears the detection doesn't work. Any ideas towards what I can do to solve it? AyeeItsSmithie -1 — 5y
0
Change text.Title in local title to textLable.Title Uluomis 32 — 5y
Ad

Answer this question