Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to make this a variable?

click.Parent.Name == "Example"

What I mean is, Is it possible to make (Example) a variable? I just wanted to know if you could do it before I attempt another method.

2 answers

✓ Accepted answer

Yes, you can make a variable equal to a string.

local x = "Example"

click.Parent.Name = x

You can make almost anything a variable. Variables are very flexible.

If you want to make the strinf "Example" variable data, than you would easily do that like so:

local varName = "Example";

or

varName = "Example";

You could also use Example as a variable name, if that is what you are asking, however to use the string "Example" as a variable name, you would have to use a key, and store it in a module, or a table of data instead, I will use the global module _G in this example:

_G["Example"] = "Example";

And I could call the value by saying:

_G["Example"]

really its just a custom index.

This discussion is preserved as it was. New answers, comments, and votes are closed.