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

How do you put strings in a variable name?

I'm curious about how to put strings in variable names. I now how to do this with a hirachy, but not a variable.

How I would do it in a hirachy

Player = plr.name
game[Player]:MoveTo(idk)

But I just don't now how to do this with strings, and what I mean by "variable name" is this

Eight = 8 -- The part before the equals sign is the "variable name"

2 comments

1

local plr = "plr1" game[plr]:MoveTo(idk) ? im not shure what you are asking?

0

read the name of the question

1 answer

✓ Accepted answer

Tables

I'm not going to encourage anything stupid here like trying to manipulate your global environment, so I'm going to instead recommend tables.

To create a table, you simply use {} as the value. After that, you can manipulate stuff just like you manipulate the hierarchy. Enjoy.

local t = {};
t[thatStringYouWanted] = 3
t.Eight = 8

1 comment

0

Thx

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