[SOLVED] <item> is not a valid member of <item> error even after WaitForChild()

I’ve come across an issue, when I get the error “<item> is not a valid member of <item>” even after I used a WaitForChild() in an if statematement.

What I’ve tried to do is the following:

ReplicatedStorage.Storage.Resources.ChildAdded:Connect(function(child)
	if child:WaitForChild("Owner", 3600) and child.Owner.Value == country.Value and child.Parent then
		-- do stuff
	end
end)

I don’t understand where the error is coming from, as the full error states:
Owner is not a valid member of <added-child>. - pointing to the line I have shown above.

Any help would be appreciated!

The error is from the second .Owner, try add WFC to it too.

But the first WaitForChild() should return nil and not continue checking the rest of the if statement?

Try this.

ReplicatedStorage.Storage.Resources.ChildAdded:Connect(function(child)
local Owner = child:WaitForChild(“Owner”, 3600)
if Owner and Owner.Value == country.Value then
– do stuff
end
end)

Also checking child.Parent if it’s not nil is useless because it is in the “Resources” Instance already.

1 Like

I don’t think it would, try adding wfc to the other check or just use a variable.

umm what? tf is wfc lol :no_mouth: didn’t heard this one before

:WaitForChild(“”) lol
(30char30char)