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

How do I get the child of an ObjectValue?

Asked by 4 years ago

For an example, there's an ObjectValue, the value of it is Player1 which is in workspace. If I want to get Player1's Head through this ObjectValue, how?

print(workspace.ObjectValue.Value.Head) -- Returns error
0
Make sure the value is actually set, print the Value first without `.Head` and see if that doesn't return nil User#834 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Use string Value with the player name you can do something like this:

local playerName = workspace.StringValue.Value --> Username

local playerHead = workspace:FindFirstChild(playerName).Head  --> Head of username
0
I would like to use ObjectValue instead, the example I provide is only an example, in my case, I need to use a ObjectValue, but anyways this have been solved, thanks for helping! Headstackk 45 — 4y
Ad

Answer this question