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

How To Change Gui Text To Number Value?

im making a kind of music box system like fnaf 2 and I need the text to change to a number value. how do I do this? here's what I have

local Number = script.Parent.Parent.Parent.Parent.Value
local Text = script.Parent

if true then
	Text.Text = Number
end

and heres my timer script

local Number = script.Parent.Value
local saliAI = workspace.AI.Sali.pathfind

if true then
	Number.Value = Number.Value - 1
	wait(3)
end

1 answer

✓ Accepted answer

If this is like the music box system, then I assume this number will constantly be winding down. It is for this reason that we should use the .Changed event

What is does is tell us when the value has changed. In this case, we would listen to when the numbervalue changes and update the text value to the new number.

local Number = script.Parent.Parent.Parent.Parent
local Text = script.Parent

Number.Changed:Connect(function()
	Text.Text = tostring(Number.Value)
end)

3 comments

0

it didnt work. is there anything i should change (like script type?)

0

nvrmind i just had to set the adornee to the part and put the billboard gui into starter gui, thx

0

i mean surface gui

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