Bulvyte
|
  |
| Joined: 21 May 2014 |
| Total Posts: 716 |
|
|
| 27 Jul 2016 07:08 AM |
local items = script.Parent.Frame:GetChildren() local notenough = script.Parent.Parent.notenough local purchased = script.Parent.Parent.purchased
for i = 1, #items do function buy() Cash = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild(items[i].Currency.Value) local diff = Cash.Value - items[i].Currency.Value.Value if Cash.Value >= items[i].Cost.Value then Cash.Value = Cash.Value - items[i].Cost.Value toolca = game.ReplicatedStorage:FindFirstChild(script.Parent.Folder.Value):FindFirstChild(items[i].ItemName.Value):Clone() toolcb = game.ReplicatedStorage:FindFirstChild(script.Parent.Folder.Value):FindFirstChild(items[i].ItemName.Value):Clone() toolca.Parent = script.Parent.Parent.Parent.Parent.Backpack toolcb.Parent = script.Parent.Parent.Parent.Parent.StarterGear print("Successfully bought!") purchased.Visible = true purchased.Text = "You have bought " ..items[i].ItemName.Value.. "!" wait(1.5) purchased.Visible = false else print("Insufficient money!") notenough.Visible = true notenough.Text = "You don't have enough " ..items[i].Currency.Value.. "!" --^^ here i kinda want to show how much more money u need to have to purchase this How can i do it ? wait(1.5) notenough.Visible = false end end items[i].BuyButton.MouseButton1Click:connect(buy) end
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 07:15 AM |
Maybe I'm not understanding correctly but I think you just have to do this: amountneeded = -difference Think about it difference = your cash - price right??? so if price>cash then doing -difference would return a positive number which represents how much money you need to reach the price here i'll show you
-difference = yourcash - price difference = -(yourcash - price) difference = price - yourcash difference + yourcash = price - so in essence yourcash needs difference more units to reach price
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Bulvyte
|
  |
| Joined: 21 May 2014 |
| Total Posts: 716 |
|
|
| 27 Jul 2016 07:28 AM |
i still don't get it, what line do ineed to put to make it show it ?
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 07:30 AM |
Write in the text line
text = "You don't have enough! You need $"..-diff.." more."
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 07:31 AM |
where it says notenough.Text = "You don't have enoguh!"
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 08:54 AM |
notenough.Text = 'You need '..math.abs(diff)..' more '..items[i].Currency.Value..'!'
I guess? |
|
|
| Report Abuse |
|
|
Bulvyte
|
  |
| Joined: 21 May 2014 |
| Total Posts: 716 |
|
|
| 27 Jul 2016 01:47 PM |
attempt to perform arithmetic on field 'Value' (a nil value)
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 02:26 PM |
| try FindFirstChild() then^ |
|
|
| Report Abuse |
|
|