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

How To Change Gui Text To Number Value?

Asked by 1 year ago
Edited 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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)
0
it didnt work. is there anything i should change (like script type?) JmoneyPlayzOfficial 49 — 1y
0
nvrmind i just had to set the adornee to the part and put the billboard gui into starter gui, thx JmoneyPlayzOfficial 49 — 1y
0
i mean surface gui JmoneyPlayzOfficial 49 — 1y
Ad

Answer this question