[SOLVED] Mouseclick script not working

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
Ex. 1.18. You can find this on the splash screen when the editor opens.
1.19
Describe the Problem
What issues are you having in the Wick Editor?
I have a mouseclick script on a key, when you click it it should make the hasKey global variable which i’ve defined in the first frame in the default script as 0 to 1. it then removes the key from the game.
What have you tried so far?
Have you attempted anything et to fix the problem? Let us know!
I’ve tried to put it in an if statement, didn’t work.
Do you have a Wick Editor File that we can see? Optional*
Attach a .wick file if you have one in progress that can help us help you!

the way you define hasKey is important. i think the only 2 ways a variable can be made global is window.hasKey or project.hasKey. (i’m not actually sure about window.hasKey)

so in the default script of the first frame you would have:
project.hasKey = 0;

and in the mouseclick script you would have:
project.hasKey = 1;

if you are already doing this or it doesnt work, send over the project file and we can figure it out

i figured it out, not entirely sure what i did but its working now. jsyk i was already using window.hasKey. i dont use let (varName) very often.
also im new how do i mark a post as the correct answer

Hey @blobstudio,
:tada: Welcome to the wick forums! :tada:

I’m glad to hear that your issue was solved :)
You can simply add “[SOLVED]” or something like that to the thread’s title to mark it as solved, and if a moderator sees that they’d usually come by and close the thread.

I already changed the title to this post so you won’t have to do anything about it this time :+1: