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

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

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

✓ Accepted answer

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

2 comments

0

Sorry, it appears the detection doesn't work. Any ideas towards what I can do to solve it?

0

Change text.Title in local title to textLable.Title

This discussion is preserved as it was. New answers, comments, and votes are closed.