Help with buy button

I am trying to make a shop, and the player can choose what amount of items to buy and the price changes along with the amount. Example: When the player selects, say 2 items, and the price of 1 item is $10, then the player will have to pay $10 x 2 = $20. However, when I try this, it reduces a lot more coins than it should. Example: when I select $20 dollars for 2 items, it reduces something like 100-200. Can you please help?

There are no errors.


function buy(v)
	if selectedTemp ~= nil then
		local coins = player.leaderstats.Coins

		local newval = (amnt.Value * v.Price.Value)

			if coins.Value >= newval then
				local new = false
				if new ~= true and new == false then
					new = true
				coins.Value -= newval
				player.ItemsInStock[v.Name].Value += (amnt.Value)
					new = false


  15:17:31.059   ▼ 1 (x5)  -  Client - MainScript:25
     15:17:31.059     1
     15:17:31.060     1
     15:17:31.061     1
     15:17:31.062     1

There are no errors in the output. Thank you all!

maybe try this?
i am not 100% sure

newval = (amnt.Value * v.Price.Value / 10)

or print each thing to see what the wrong thing

It won’t work because some numbers are like 74 or 19 so they will become decimals.