I'm trying to get some Text to change whenever a Value is changed. So far I have this but it doesn't work.
01 | local Text = script.Parent.Text |
02 | local Title = script.Title.Value |
03 |
04 | local function updateText() |
05 |
06 | Text = Title |
07 |
08 | end |
09 |
10 | status.Changed:Connect(updateText) |
11 | updateText() |
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!
1 | local textLable = script.Parent --Makes a variable for the text |
2 | local title = text.Title -- Makes a variable for the Title/Value |
3 |
4 | textLable.Text = title.Value -- Sets the text to the value when the script is first ran |
5 |
6 | title.Changed:Connect( function () -- Detects when the titles value changes |
7 | textLable.Text = title.Value -- Sets the text to the value |
8 | end ) -- Ends the function |