X is not a valid member of Model

Hello, I’ve been trying to index an invisible wall and turn the cancollide off but I keep getting the message ‘inviswall is not a valid member of Model’.

    function touch(thing)
    	if thing.Parent:FindFirstChild("Humanoid") then
    		script.Parent.Parent.Parent.inviswall.CanCollide = true
    		wait(1)
    		local anim = TweenService:Create(part, tweenInfo, {Position = EndPosition})
    		anim:Play()
    	end
    end

Here is a picture of the hierarchy. (the script is highlighted in blue)
hierarchy

Though I doubt this is the case, try script.Parent.Parent.Parent:WaitForChild("inviswall")

This is a bit of a long shot, but is inviswall by any chance unanchored and/or does it have Archivable = false? I tried a similar setup with the same code, and it worked fine for me.

If it’s unanchored and CanCollide is initially set to false, the part will fall through the ground and eventually (within a few seconds of the game starting) be destroyed.

1 Like

Thank you! My wall was unanchored and I didn’t see.

1 Like