Error when trying to :FindFirstChild with ObjectValue

Instead of getting the value, It’s returning a nil value to me. I’m trying to use ObjectValue.

local Block = workspace:FindFirstChild(Player.Values:FindFirstChild("EditingModel").Value)
print(Block.Name)

I checked the ObjectValue and it’s normal, can someone help me?

1 Like

What here is the ObjectValue? You can access an ObjectValue’s configured value like you would with any other value. ObjectValue.Value returns a reference to the object you have previously configured.

1 Like

The ObjectValue is set inside of the Player.Values Folder.

Try using :WaitForChild() instead of :FindFirstChild()

Sometimes it takes time to load…

It’s not the case, the RemoteEvent is conditional to another value, another idea?

The ObjectValue is an Object, not a name.

local Block = Player.Values:FindFirstChild("EditingModel").Value

Let’s break down what the script you provided is doing.
You’re using two :FindFirstChild() calls, which does seem unnecessary for this purpose. The :FindFirstChild() method takes a string as a parameter and returns an Instance or nil. As such, using two of these calls inside of eachother is guaranteed to result in script failure.
(Sorry I didn’t pick up on this in my first post.)

I’m going to make some assumptions here: The ObjectValue you are trying to access is an ObjectValue named EditingModel inside Player.Values. The local Block is the value of this ObjectValue.
If this is the case, you shouldn’t refer to workspace at all. Try: local Block = Player.Values:FindFirstChild("EditingModel").Value

This may or may not work, I’ll need further info to narrow it down.

I know, I’m trying to print the .Name of the object referenced by the ObjectValue

local Block = Player.Values:FindFirstChild("EditingModel").Value.Name

So, how I should pick a object with ObjecValue from workspace?

EditingModel.Value is the object. That is all you need.

This variable will search a property inside another property, I think it will give me a error.

Are you trying to assign an object to an ObjectValue?

What are you trying to do exactly? Why does this line of code matter?

Yes, I’m trying to assign an object to ObjectValue.

I’m trying to print the .Name just to see if the code works, it will be a grid placement system.

well in that case try using this:-

local Block = Player.Values:FindFirstChild("EditingModel")
Block.Value = -- whatever object you need to assign to the object value --

This is how you assign.

local Block = Player.Values:FindFirstChild(“EditingModel”).Value
print(Block.Name)

This is how you print the name.

Sorry, I already assigned it, but I need to get the workspace object from it.