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

I am trying to change text on an int value but ge no error?

Asked by 5 years ago

I am making an indiana jones themed adventure game and am trying to make an extra lives GUI that changes to an int value when the int value changes but for some reason the GUI text is not switching values. I get no error either.

local rtl = script.Parent.RealTimeLives
local el = script.Parent.ExtraLives
local healthbars = script.Parent.HealthBars
local elt = healthbars.ExtraLivesText.Lives.Text 

el.Changed:Connect(function()
    wait()
    elt = "+"..el.Value
end)
0
try wrapping the text you are changing it to with a tostring Trollapse 89 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

try adding tostring() to 'el.Value' on line 8

local rtl = script.Parent.RealTimeLives
local el = script.Parent.ExtraLives
local healthbars = script.Parent.HealthBars
local elt = healthbars.ExtraLivesText.Lives.Text 

el.Changed:Connect(function()
    wait()
    elt = "+".. tostring(el.Value)
end)
Ad
Log in to vote
0
Answered by 5 years ago

use a tostring(). it casts the input to a string.

local a=1
print(tostring(a))

Answer this question