Global/Local Variable

What is the difference bwtween the two?

A global variable is a variable declared on the special Stage Actor, and is easily visible/accessible in ALL Actors in a project.

A local variable is a variable declared on any Actor that isn’t the Stage Actor, and is only easily visible/accessible to that particular Actor.

If a local variable and a global variable share the same name, the local variable takes precedence (the global variable) is ignored.

There is also another type of variable called a script variable, which is only visible/accessible to code blocks in the same connected code block chain. They aren’t even accessible to other scripts in the same Actor.

I demonstrated to the students how to create a global variable and some created a global variable and some ended up with a local variable. What did the students the students do that they ended up with a local variable?

When creating a global variable, make sure to select the “For all Actors” radio bubble.

Selecting the “For this Actor only” creates a local variable.

Also, in Tynker, all variables created on the “Stage” Actor are global.

I assume you were starting with the default project that has a template actor and an empty Stage.
Your students probably had the template Actor (Codey) selected when they created the variable, and then they also did not select the “For all Actors” radio bubble option.