Hi Jennifer,
Variables are always local in MiniScript, unless you explicitly prefix them with something like globals.
or outer.
to indicate a different scope.
When you read a variable without an explicit scope, it will look first in locals, then in the outer scope (for example, if your function is inside an import module or inside another function), and then in the global scope. So you generally don't need any prefix for reading a variable — it will find it wherever it is.
But when you assign a new value to a variable without an explicit scope, this will always create or update a local variable. Even if there happens to be a global of the same name. So in your code above, the line
x = x + 5
says: (1) find the nearest variable named "x"; (2) add five to its value; (3) store this in a local variable called "x".
To get the behavior you expected — i.e. updating the global variable — you need to make that line instead be:
globals.x = x + 5
or equivalently:
globals.x += 5
Hope this helps!
— Joe
P.S. To properly format your code, put three back-ticks (`) around it. And do not include spam links in your post. (I've edited your post to fix both these issues.) Spamming will get you banned if you continue to do it. But as long as you are discussing MiniScript, and not including spam or spam links, you are welcome here. ❤️ Perhaps with your new coding skills, you can give up your career as a spammer and go into IT instead!