I am trying to make a game and the value of the cost won't go up. The error is one that I have never gotten before. Error: Players.Player1.PlayerGui.BuyGui.BuyFrame.ImageButton.Buy:6: attempt to perform arithmetic on upvalue 'cost' (a userdata value)
local persec = script.Parent.Parent.Parent.Parent.ClickGui.PerSec
local money = script.Parent.Parent.Parent.Parent.ClickGui.Number
local cost = script.Parent.Cost
script.Parent.MouseButton1Click:connect(function()
if money.Value > (cost - 1) then
persec.Value = persec.Value + 0.1
money.Value = money.Value - cost
cost.Value = cost.Value + (cost.Value * 1.06)
end
end)

3 comments
A simple mistake. Thanks. I completely forgot about the value of the number. :3
BlueTaslem. Whenever I buy the thing it always makes the perSec value go up by 0.10000000023278. or something like that. Is there a way to prevent this? Or is there a simple script that I could use? If there is a script could you post it?
That is 0.1, or as accurately as ROBLOX's number system can represent it. You'll just have to deal with that value wherever you see it -- if it's messing up display, try different rounding techniques (you should be able to find them on this site)