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

How can you use a variable when doing “:findfirstchild()”?

How can I make the following example work?

local myVariable = potato local PotatoWS = game.Workspace:findfirstchild(myVariable)

1 comment

0

Just put the word potato in quotes like this, "potato", and change :findfirstchild to :FindFirstChild.

2 answers

I think it's like this,

local myVariable = "potato" -- In quotes so u get no errors

local PotatoWS = game.Workspace:FindFirstChild(myVariable.Name) -- this could be myVariable and also do FindFirstChild is captilized

1 comment

0

There is no .Name needed after myVariable, apart from that it is correct.

local myVariable = "potato"
local PotatoWS = game.Workspace:FindFirstChild(myVariable)

Please accept this answer if it worked!

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