This is the actual function
---
function buy (thing,price,upgrade,type)--real function
--VARS
if thing == 1 then
thing = UPMouse --upgrade1
--elseif true then
--upgrade2
end
---
if price == 1 then
upgrade = UPMouse.Price.Value--upgrade1
end
---
if upgrade == 1 then
upgrade = UPMouse.Upgrade.Value--upgrade1
end
-----------------------------------
local number = value.Value - price
local color = thing.TextColor3
if number < 0 then -- if not enough money
thing.TextColor3 = Color3.new(255,0,0)
thing.Text = "Not enough money"
for i=1,10 do
thing.Visible = false
wait(.01)
UPMouse.Visible = true
wait(.01)
end
thing.TextColor3 = color
thing.Text = thing.Name.." $"..tostring(thing.Price.Value)
elseif number >= 0 then --if enoughmoney then
value.Value = value.Value - price--Upgrade as needed
if type == 1 then
CPS.Value = CPS.Value + upgrade
elseif type == 2 then
ClickIncrease.Value = ClickIncrease.Value + upgrade
end
--Change values
thing.Price.Value = thing.Price.Value + UPMouse.Price.Value/2
thing.Upgrade.Value = thing.Upgrade.Value
thing.Text = thing.Name.." $"..tostring(thing.Price.Value)--good
end
end |