# Hitting zero with a button

**URL:** <https://forum.kirupa.com/t/hitting-zero-with-a-button/288442>\
**Category:** Uncategorized\
**Created:** [May 15, 2009, 5:55pm UTC](https://forum.kirupa.com/t/hitting-zero-with-a-button/288442 "2009-05-15T17:55:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saintdave](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@saintdave](https://forum.kirupa.com/u/saintdave)\
**Post date:** [May 15, 2009, 5:55pm UTC](https://forum.kirupa.com/t/hitting-zero-with-a-button/288442/1 "2009-05-15T17:55:25Z")

</div>

I’m using mx2004, and here is my issue…  
I have 2 variables, craft and avilablepoints, now when you hit the crafting button, it subtracts 1 point from avilablepoints, and adds 1 to the craft variable. I got that coded without an issue. I’m having trouble setting up the button to stop adding when availablepoints hits zero. What should I do?  
Here is the code I have so far…

on(release) {  
craft++;  
avpoints–;  
}

I had more code, but nothing worked for me.  
Any suggestions?
