Trying to add +1 value to text label not working


You can’t add or subtract a string. It is not a arithmetic value. Instead, set a cash variable that stores the amount of cash and then set the text to that variable value

Here is an example:

local CashAmount = 100
local CashValueScreen = --reference the UI Element


local function CashGive(amount)
  CashAmount += amount
end

while true do
 CashValueScreen.SurfaceGui.Textlabel.Text = CashAmount
end
1 Like

Oh yeah!! Thank you so much, i knew i couldnt add or subtract strings but it was the best i could do!

1 Like

no problem! Good luck scripting!

Thank you, and you, have a nice day

If you are gonna use Cash as an IntValue, please avoid while true do loop and use .Changed event instead

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.