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

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

Asked by 9 years ago

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

Log in to vote
1
Answered by 9 years ago

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.

Ad
Log in to vote
0
Answered by 9 years ago

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.

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. chess123mate 5873 — 9y
0
Oh ok, thanks for telling me. TerraSky 5 — 9y

Answer this question