# When I click a button this happens but if something is in its place it moves to a different space

**URL:** <https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887>\
**Category:** CS Principles\
**Tags:** applab\
**Created:** [January 11, 2024, 2:35pm UTC](https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887 "2024-01-11T14:35:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spoonrogers](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@spoonrogers](https://forum.code.org/u/spoonrogers)\
**Post date:** [January 11, 2024, 2:35pm UTC](https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887/1 "2024-01-11T14:35:40Z")

</div>

When I click “DownloadGameButton” I want an element to appear on a different screen, but if another element is in that place I want it to move to a different place. But before I click “DownloadGameButton” I click “CookieClickerButtonGameDownloader” it changes the screen and make 2 elements show when I click a different button on the same screen the image changes on the same screen, and it will show 2 different elements on a different screen.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [January 11, 2024, 3:18pm UTC](https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887/2 "2024-01-11T15:18:07Z")

</div>

@spoonrogers,

Welcome to the forum. I’m assuming this is in App Lab? I’m having a bit of a hard time envisioning what is happening. Can you share your app with us so we can look at it closer? If we can see it / play with the code, it’s a lot easier for us to help troubleshoot.

thanks!

Mike

---

<div class="post-metadata">

**Author:** ![spoonrogers](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@spoonrogers](https://forum.code.org/u/spoonrogers)\
**Post date:** [January 18, 2024, 3:11pm UTC](https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887/3 "2024-01-18T15:11:09Z")

</div>

Of course. The main screens that are focused in this is “GameDownloaderScreen” and "Xpwallpaper/StartButton/Icons. In more detail what I want to happen is, When I click “CookieClickerButtonGameDownloader” I want “CookieClickerSS” to change to the current image, then when I click “DownloadGameButton” if the image is a cookie, then it will show 2 different elements on a different screen. But if a certain element is shown where the element is supposed to show, then it will move to a different location. The screen I want the elements to show is "Xpwallpaper/StartButton/Icons. Here is my app ([Code.org](https://studio.code.org/projects/applab/DPoBYUMLlj4CjEBeenHiAU3ECDLMOOf40tSrnBEer0g/edit)(

---

<div class="post-metadata">

**Author:** ![bhatnagars](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bhatnagars/32/4919_2.png) [@bhatnagars](https://forum.code.org/u/bhatnagars)\
**Post date:** [January 18, 2024, 5:10pm UTC](https://forum.code.org/t/when-i-click-a-button-this-happens-but-if-something-is-in-its-place-it-moves-to-a-different-space/38887/4 "2024-01-18T17:10:47Z")

</div>

The program is pretty long and confusing. I looked at your DownloadGameButton click event. In this onEvent you are getting the property of the GameDownLoaderPlaceHold element and comparing to a. But I cannot see where this property is getting set. Currently it is an empty string, hence the condition in your if statement is false and the screen does not change.

```auto
onEvent("DownloadGameButton", "click", function( ) {
  if (getProperty("GameDownloaderPlaceHold", "value") == a) {
    showElement("CookieClickerButton");
    showElement("CookieClickerLabel");
  } else {
    setScreen("GameDownloaderScreen");
  }
});

```
