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.

local Text = script.Parent.Text
local Title = script.Title.Value

local function updateText()

    Text = Title

end

status.Changed:Connect(updateText)
updateText()

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!

local textLable = script.Parent --Makes a variable for the text
local title = text.Title -- Makes a variable for the Title/Value

textLable.Text = title.Value -- Sets the text to the value when the script is first ran

title.Changed:Connect(function() -- Detects when the titles value changes
    textLable.Text = title.Value -- Sets the text to the value
end) -- 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