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

How would i change the text of a textlabel with the number of a Value?

The thing is, I made a brick. inside that brick theres an 'IntValue' I'm trying to change the text of a textlabel to the value of the IntValue.

So here's the script.

debounce = false
t = script.Parent.TextLabel
v = game.Workspace.money.money
game.Workspace.actualmoney.ROBUX:connect(function()
if not debounce then
t.Text = v.Value
debounce = true
 end
end)            

THIS SCRIPT HAS BEEN TESTED AND DOES NOT WORK.

2 answers

✓ Accepted answer

No matter what "ROBUX" is, you're using it wrong. See BindableEvent and RemoteEvent for how to use them.

Further, you never set "debounce" to false, meaning your script could only update the TextLabel once.

I recommend changing line 4 to v.Changed:connect(function() - this way the TextLabel always mirrors the value of the IntValue.

Also, note that it's a good idea to check the Output window (or Developer Console if you're online -- press F9 for it) for errors; if you can't figure out how to fix it based on what it tells you, then show us the relevant error as well.

I'm not sure if this would work, but you could try using tostring() on the int value because I think the text of the text label is a string so you can't put an int value into a string value. So tostring() would convert the int value into a string value.

2 comments

0

It's a good idea to do this, but I just tested it and you don't actually need to do it; the number is automatically converted to a string.

0

Oh ok, thanks for telling me.

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