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 use a variable as a location?

Basically I want to know if you can use a variable for the name of locating a file. I'll give you an example below (it might not be right though which is why I'm asking how to do it) I was just curious if this is how you do it or there is another way. (In this case part1 is a part in workspace with the name part1 I'm just using a variable string value) Don't ask why I need this, I'm just curious and wanna know.

thebestpart = "part1"

game.Workspace.thebestpart.Transparency = 0

1 answer

✓ Accepted answer

You can, but you must use brackets in the form of [string].

Here would be a working script:

thebestpart = "part1"

game.Workspace[thebestpart].Transparency = 0 --Note the period after the brackets and not before.

2 comments

0

Thanks

0

Np. :)

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