It seems to me that the script is using “OwnerDoor” before it exists. Meaning your script is executing before it is within workspace. This could be that you’re cloning it to workspace after, or another issue.
Try:
MainItems:WaitForChild("MainDoor")
Let me know if that resolves the problem.
Nil = non-existant.
Instead of the MainItems:WaitForChild() line. Make sure it’s only one line what you paste. Also, quick note, I made it so that if it doesn’t find the item in one second, the code doesn’t run.
Yes. That should work. If you don’t want the function to not run if it doesnt find the instance, type the line like this:
MainItems:WaitForChild("OwnerDoor"):WaitForChild("MainDoor").Touched:Connect(function(hit)
ONLY do that if you want to see if the instance doesnt exist. If it doesn’t, you will see an error: "infinite yield possible on [v:WaitForChild()].