I tried to do this it didn't work so I believe that I did something wrong. (Yes its a local script.)
local stock = game.Players.LocalPlayer:WaitForChild("Stocks").ONE.Value local cash = game.Players.LocalPlayer:WaitForChild("leaderstats").Cash.Value local OPrice = game.Workspace.ONEVal.ONEPrice local a = game.StarterGui.CashNStuff.Frame.Investments.Buy1 local stock = tonumber(a.Text) a.Text = tostring(stock) script.Parent.MouseButton1Click:connect(function() if cash > OPrice.Value then stock = stock + 1 and cash == cash - OPrice.value and a.Text == tostring(stock) else print("Not enough cash") end end)
UPDATED still error
You can't compare an integer value to a string value which you do:
if cash == game.Workspace.Board.SurfaceGui.SmoothGUI.PriceONE.Text
The cash is an integer (number), while the text is a string value. Possibly using an IntValue object and comparing cash to that, I would suggest using a > sign rather than = would work. Hope this helped!
Johner to fix your error that you commented under JackOfAllBlox's answer, you would use tostring() and tonumber(). This converts the stringvalue of the number to a number, and you could change it back to the string after performing the arithmetic. For example,
local a = game.StarterGui.ScreenGui.Frame.TextLabel.Text local b = tonumber(a) b = b + 1 a = tostring(b)
Edit: Actually that script would not work since I did TextLabel.Text I would have to do:
local a = game.StarterGui.ScreenGui.Frame.TextLabel local b = tonumber(a.Text) b = b + 1 a.Text = tostring(b)