How to find the object that is inside an object value?

Like the title says, I’d like to know how I can find the exact object that is inside an objectvalue.
Thanks in advance.

2 Likes
local ObjectInsideObjectValue = ObjectValue.Value
1 Like

I meant like how do I find the exact object that is inside an objectvalue’s value. Like for example my object value’s value is a part named “Hello” and I wanna find that object in replicatedstorage but there are multiple parts named “Hello” so I want the exact one.

1 Like
local objectVal = workspace:WaitForChild("ObjectValue")
local objectValValue = objectVal.Value

The value will always point to the object which is used to set the value regardless of how many instances share the same name. The value isn’t a string value of the name of the object, it’s the object itself.

1 Like

I will try that, I’ll let you know.

1 Like

Hey so, I have another example to ask. If I had another object value inside an objectvalue, how will I refer to that object value? For example, I have an objectvalue named “Kek” and another object value INSIDE it named “Kekw”, how will I be able to refer to the “Kekw” objectvalue using the “Kek” objectvalue’s value?

(Sorry if this is hard to understand xD)

1 Like
local kekObject = workspace:WaitForChildOfClass("Kek")
local kekwObject = kekObject:WaitForChildOfClass("Kekw")
local kekwObjectValue = kekwObject.Value

Do you mean like this?

1 Like

An ObjectValue.Value just points to an Instance.The Instance can be another ObjectValue or it can be whatever you want.

You retrieve the “Value” (Instance) of an ObjectValue by doing ObjectValue.Value

There’s nothing more to it.

1 Like

Nope, I wanna find the “Kekw” objectvalue using the “Kek” objectvalue’s value

1 Like
local kekObject = workspace:WaitForChildOfClass("Kek")
local kekObjectVal = kekObject.Value
local kekObjectValValue = kekObjectVal.Value
1 Like

Here’s another example

I have an object value named jojo
inside the jojo object value is another object value named josu.

If I was to refer to the josu objectvalue, how would I do it by using jojo’s value
like for example:

local josu = jojo.Value:FindFirstChild("josu")

again, I’m sorry for confusing you.

2 Likes

All you need to know is that the value of an ObjectValue refers to the instance that is set as that ObjectValue’s value.

2 Likes

You are getting confused between Children and Value.

The ObjectValue.Value is a property of ObjectValue. Any Instance can have any number of children and they can be any Instance

2 Likes

So that means i can just do ObjectValue.Value:FindFirstChild(“AnotherObjectValue”)?

2 Likes

Yeah, I am. I’m saying there’s another object value as a child of the main objectvalue so I want to find that child using the main object value’s value

1 Like

If it was a child but you need to understand the difference between a child and the property objectvalue.Value


You can find any child of any instance by doing :FindFirstChild(name), this has nothing to do with ObjectValues

1 Like
local ObjectValue1 = workspace:WaitForChild("ObjectValue1")
local ObjectValue1Value = ObjectValue1.Value

local ObjectValue2 = workspace:WaitForChild("ObjectValue1")
local ObjectValue2Value = ObjectValue2.Value

local ObjectValue3 = workspace:WaitForChild("ObjectValue1")
local ObjectValue3Value = ObjectValue3.Value

local ObjectValue4 = ObjectValue1:WaitForChild("ObjectValue4") --object value inside object value
local ObjectValue4Value = ObjectValue4.Value
1 Like

Why are you stacking ObjectValue’s anyway? Seems unnecessary.

2 Likes
local ObjectValue1 = workspace:WaitForChild("ObjectValue1") --THE VARIABLE POINTS TOWARDS THE OBJECTVALUE INSTANCE ITSELF
local ObjectValue1Value = ObjectValue1.Value --THE VARIABLE POINTS TOWARDS THE VALUE OF THE PREVIOUS OBJECTVALUE WHICH IS SOME OTHER INSTANCE

local ObjectValue2 = workspace:WaitForChild("ObjectValue1")
local ObjectValue2Value = ObjectValue2.Value

local ObjectValue3 = workspace:WaitForChild("ObjectValue1")
local ObjectValue3Value = ObjectValue3.Value

local ObjectValue4 = ObjectValue1:WaitForChild("ObjectValue4") --THIS VARIABLE POINTS TOWARDS AN OBJECTVALUE INSTANCE INSIDE AN OBJECTVALUE INSTANCE
local ObjectValue4Value = ObjectValue4.Value --THE VARIABLE POINTS TOWARDS THE VALUE OF THE PREVIOUS OBJECTVALUE WHICH IS SOME OTHER INSTANCE
2 Likes

It seems you don’t know how Instances work. A good place to start is to learn about them.

I think this video covers it not sure you could always look at developer.roblox.com

2 Likes