How do I make a player gain a player attribute when buying a item, and having the item being gone (basically a selling system)

How do I do that? I need to know how to do that for a game I’m making.

if variable[Has boost] is false
for all units in the game
for all items in items owned by selected unit
if item type of owner of selected item = (item that gives boost)
Set player attribute Hp as Hp + 100
Set player variable [Has boost] as true

or go to item pasive boost and give it a boost for when you have it

You’re explaining the wrong thing, what I need is, for example, a person buys (well sells) a thing for 10 gold and the price is 1 of the thing, but the item isn’t gone. I can’t have my players having an infinite money system.

oh that’s not fixable if an item costs other items than you can’t make it cost an attribute

Oh nevermind, I think I can just do a script where when a player purchases an item, set the quantity of the item has quantity of item - 1.

You don’t need a script for this…? Just make the item cost another item, so when they buy it, it will take away the items that it costed. And add a negative price to the item so it increases their player attribute when they buy it

Well, this is what I put for the Price:
Player Attributes: -5 Gold
Item Stuff (Recipes): (item name)
But the amount of item the player has won’t go down.

Did you put that in price or requirements?

Both in price I believe.

1 Like

What are the Default quantity and Max quantity of the item set as?

Default Quantity: 1
Max Quantity: 9999 (because when I used max quantity as infinite it wouldn’t stack).