Delete the objects when the player clicks on the background?

I attached a photo below, but I want to make it so that when the player clicks on the background and doesn’t click on the object that’s shown, it deletes the object and the player can return to the game. How do I go about that? Thank you in advance. c:

Invert condition “Cursor/touch is on key” and confirm there is at least one key on the screen:

1 Like

Alright, I will try it and get back to you.

Edit: I tried the code and it didn’t work? Even without the quotation marks on “Count(Key)” it didn’t work (I took the screenshot before I removed the quotation marks a second time) and I’m not sure what the issue could be,

Count(Key) is a function that returns an integer. Putting it in quotes will only make the whole thing a string - “Count(Key)”. It won’t put the result of Count(Key) into a string.

You also don’t want the 1 in quotes. You are comparing 2 numbers, so putting the value in a string won’t work. Make sure you’re using compare 2 numbers, and not compare 2 strings.

Also, you need to invert the condition “The cursor/touch is on Key”. Otherwise it will only work when the mouse is over the key object, which is not what you’re after.

1 Like

Thank you, I fixed the coding and it worked! Appreciate the help. c: