Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use a value as a child?

Asked by 4 years ago

So pretty much I have a value like this for example:

local client = game.ReplicatedStorage.Client.Value

How would I use it like this:

game.Players.--the client value

1 answer

Log in to vote
0
Answered by 4 years ago

There are two ways you can come through this problem. One of them is :FindFirstChild(). This will take an input of either a variable, or string (as long as the variable is a string) and will find a child with that name. The other way of doing it, is to use the parent as a table. Eg. game.Players[childName]. In the brackets you would do the same thing as FindFirstChild with the variable or string.

Putting this together, you could use it as:

local client = game.ReplicatedStorage.Client.Value
local plr = game.Players:FindFirstChild(client)
Ad

Answer this question