Changing a string to a variable name

I am trying to save a storage that will store unlocking and locking levels. I am trying to do it in an easier term like this:

CurrentSceneName() = A level number(string)
Global Variables = named like this “lev” + CurrentSceneName()

I tried to do it this method but it never accepts. It there any other way?

Use a structure variable. This is a dictionary, with a key-value pairing.

You could name the structure “Levels”, and the children would take the “variable” name, and the value would be the variable value. So it would look like:

image


And you would access the value with:

Levels[“Lev” + VariableString(CurrentSceneName()]


So if the CurrentSceneName() is 2, then you’d get “UnderwaterScene” from the previous line.

* Levels["lev" + CurrentSceneName()]

1 Like

So this answer will make the variable name the current scene name