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

Can I use a Variable after workspace to find stuff in the workspace?

I have a folder in the workspace that i want to reference. The folder is named "Player" Stand. For ex, mcslimeman Stand. I alsohave a variable that is named folder, shown below

local folder = (playerstring..stand)

playerstring is the name of the player, and stand is just " Stand". Can I do local "name" = workspace.folder, so in theory, it would act like workspace.player Stand?

1 answer

✓ Accepted answer

I don't exactly understand what you're trying to do but if you're trying to find something in the workspace, that probably would work.

For example, I have a model in the workspace called "PhantomBlox27 Stand" and I have a variable of the player name, I could find it by doing this:

local stand = workspace[playerName.. " ".. "Stand"]

2 comments

0

First of all, thanks, it worked. I just have some remanding questions. why do we use [] instead of like () or .?

0

I haven't read up on that but I'm assuming it treats the workspace as like an array, so workspace["Part"] would be finding something in the workspace called Part, you can also use workspace:FindFirstChild(playerName.. " ".. "Stand") if you want.

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