.Parent not working on ObjectValue.Value?

I really don’t get why this isn’t working when it should be working.
I’m getting the value of ObjectValue which is an instance and then getting the Parent of that ObjectValue.Value… which works.

But as soon as I try to do anything with that it goes poof, gone.

local Dependent = Button:FindFirstChild("Dependent")
	if Dependent then
		local DepValue = Dependent.Value
		local DepButton = DepValue.Parent
		for _,part in ipairs(DepButton:GetChildren()) do
			if part:IsA("BasePart") then
				part.Transparency = 0
				part.CanCollide = true
--[[ -- Output
18:31:49.947  Head  -  Server - Script:91
18:31:49.947  Top Level_Button  -  Server - Script:92
18:31:50.830  Workspace.TycconTest1 ------.Script:89: attempt to index nil with 'Parent'  -  Server - Script:89

It’s because the value of the DepValue is nil, did you add the value to it?

Yes I did, check the output it should be there. The error occurs when

for _,part in ipairs(DepButton:GetChildren()) do...


Edit: Nvm it’s the wrong error.

nvm nvm nvm nvm nvm nvm nvm nvm nvm nvm .

I think its all from the output.

I’m looking at my screen directly and I can see that ObjectValue(Dependent) has a value inside of it. I just don’t get why it keeps saying nil.

Is it because load times?

Did you change the value on studio or in-game?

I changed the value in studio. I usually click on the property Value and then click on a Part.

Edit: hold on I think it might be a plugin problem

Ok so I found out the problem which seems to be a bug.

There’s a plugin I created that instantly creates an ObjectValue, names it “Dependent” and then Parents it to that model I have selected over.

It’s not being treated as an ObjectValue properly.

Is that the solution to this question?

1 Like

That appears to be, that it’s a bug…

If you’re using a plugin that creates an ObjectValue, try doing it manually by inserting an object and copying the same property the plugin objectvalue has.

1 Like

Ok so apparently the plugin wasn’t the problem. I did what you wrote down and that seemed to fix the problem.

It has something to do with CanColllide, I added this code down and now the problem seems to be gone.

if not Button.PrimaryPart.CanCollide then return end

It was another thing where CanTouch was triggering even though CanCollide was set to false. Not sure if that’s intentional.

Edit: I’ll let you know that I wasn’t making these stuff up.

Yes, it’s intentional, the CanTouch boolean is a boolean that returns the touched function as true or false, which means the touch function activates if the CanTouch function is true, even if the CanCollide value is set to false.