# Need a debug in my game

**URL:** <https://forum.makecode.com/t/need-a-debug-in-my-game/6789>\
**Category:** Help\
**Created:** [March 15, 2021, 10:50pm UTC](https://forum.makecode.com/t/need-a-debug-in-my-game/6789 "2021-03-15T22:50:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandodon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brandodon/32/3625_2.png) [@brandodon](https://forum.makecode.com/u/brandodon)\
**Post date:** [March 15, 2021, 10:50pm UTC](https://forum.makecode.com/t/need-a-debug-in-my-game/6789/1 "2021-03-15T22:50:35Z")

</div>

> **[Gunslinger(For2PlayerGame)](https://arcade.makecode.com/99942-96246-07531-49507)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

This is for another game, but for some reason, it’s just not working right. I have a variable called ‘canShoot’ and it’s set to false. I want the game to make sure that when the “Shoot!” text isn’t there, you can’t shoot. And if you do shoot, it’ll say “False start! Player \_ won!”. But when the ‘Shoot!’ text is there, then you can shoot and it’ll determine the winner

---

<div class="post-metadata">

**Author:** ![KIKIvsIT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kikivsit/32/10492_2.png) [@KIKIvsIT](https://forum.makecode.com/u/KIKIvsIT)\
**Post date:** [March 16, 2021, 12:20am UTC](https://forum.makecode.com/t/need-a-debug-in-my-game/6789/2 "2021-03-16T00:20:12Z")

</div>

Take a look at where you say if (canShoot = true) … that’s setting it to true instead of checking that it is. Fixing that might lead you closer to a solution!

I changed (canShoot == false) to (!canShoot) and (canShoot == true) to just (canShoot) and it seems to have helped.

---

<div class="post-metadata">

**Author:** ![brandodon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brandodon/32/3625_2.png) [@brandodon](https://forum.makecode.com/u/brandodon)\
**Post date:** [March 16, 2021, 1:19am UTC](https://forum.makecode.com/t/need-a-debug-in-my-game/6789/3 "2021-03-16T01:19:43Z")

</div>

When I changed it, the false start text showed up when I false-started, but when I waited normally it didn’t change to the correct player winning

---

<div class="post-metadata">

**Author:** ![KIKIvsIT](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kikivsit/32/10492_2.png) [@KIKIvsIT](https://forum.makecode.com/u/KIKIvsIT)\
**Post date:** [March 16, 2021, 1:34am UTC](https://forum.makecode.com/t/need-a-debug-in-my-game/6789/4 "2021-03-16T01:34:14Z")

</div>

It looks like you’re also calling the A button events inside of the if statements, instead of the other way around. Try putting a conditional to check for canShoot inside the player 1 A and another one inside the player 2 A. (And have both A button events be their own events outside of the on start.)
