Hi, I was recently recommended to use Global Session Varible, but they are buggy. Try to set the event "Set global varible to 10", for example, on the right mouse click. The global variable will create chaos, it can even take negative values. I can't create anything serious on your product, I really hope that this error will be corrected, well, and a flaw with Overlay
Issue comments
Global variables indeed support negative values (and you said you set it to 10 which is not negative?). But keep in mind that on servers, session variables won't work properly as server and client hold their own session variables, so to link them, you need to use global variables such as map type.
I suggest you to play a bit with them as you should get them to work, just make sure to use proper sides (client, server) and keep an eye on this bug/lack of feature which can badly interfere with variables: https://mcreator.net/tracker/issue/50752
If you get -1 value, this means variable was not set yet. Even if you play singleplayer, you have two separate sides with separate variable sets: one for server and one for client.
Procedures that get triggered on both client and server (most of them) happen on both sides and for one side (most likely client) you get -1 as variable is not defined there, but for server it is so the value is jumping between these two values.
Similar issue: https://mcreator.net/tracker/issue/51667
In particular, I'm talking about demonstrating a variable in a GUI or HUD.