How would I take away a set amount from a value

I am attempting to take away a set amount from a value using a code.

How would you do this?

hit.Cash is the value I am taking away 1 from.

What do you mean?
Can’t you do this:

local cash = 50
local cashToTakeAway = 20
cash -= cashToTakeAway
print(cash) -- 30
3 Likes

The cash needs to be different for each individual part (or card)

It’s stored on a value in the handle of the card.

Screenshot_13

You can simply subtract (-) 1 from hit.Cash.Value: hit.Cash.Value -= 1 (just a more specific reply if you will.)
And remember to reference the .Value as most people forget this, it will only reference the object if you don’t do so.

2 Likes

Thank you for this, I didn’t realise you had to use an = in the operations.

I kept doing just - on it’s own.

This has worked

1 Like