# Need help with variables

**URL:** https://forum.kirupa.com/t/need-help-with-variables/216908
**Category:** Uncategorized
**Created:** [February 21, 2007, 4:03pm UTC](https://forum.kirupa.com/t/need-help-with-variables/216908 "2007-02-21T16:03:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Zhet](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/zhet/32/3307_2.png) [@Zhet](https://forum.kirupa.com/u/Zhet)
#### Post date: [February 21, 2007, 4:03pm UTC](https://forum.kirupa.com/t/need-help-with-variables/216908/1 "2007-02-21T16:03:10Z")

</div>

I was kinda wondering how to make global var’s?  
I made a variable at the main time line  
var goodch:Number = 0;  
if (goodch==5)  
{gotoandplay(4);}

And a string at a movie clip that adds +1 to goodch when clicked.  
on (press)  
{goodch +=1;}

I’ve pressed 5 times, nothing happened. Trace(goodch) always return undefined and trace(int(goodch)) always 0 ;
