ContextActionService:BindAction can only be called from a local script

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.

Try print(MainItems.OwnerDoor.MainDoor.Name) and see if it’s the problem of your pathing. If that errors use WaitForChild()

do i just delete that line and paste it in?

Yeah, exactly that. Let me know.

MainItems:WaitForChild("OwnerDoor", 1):WaitForChild("MainDoor", 1).Touched:Connect(function(hit)
--code here
end)

This should (also) work if your pathing’s correct

It fixed that error, now there is annother
image

Can we see what exactly you wrote?

MainItems:WaitForChild("MainDoor").Touched:Connect(function(Hit)
 // code here
end)

You don’t have this line:
MainItems:WaitForChild("OwnerDoor", 1):WaitForChild("MainDoor", 1).Touched:Connect(function(hit)

which line do i paste it on?
im just curios.

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.

i dont understand, do i delete the MainItems:WaitForChild() line then paste it in?

1 Like

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()].

It came up again, I just didnt notice it,
image

Also came up with this error
image

Is it a server or local script? Where is it located?

I put it in scs

image

You should use starterplayerscripts rather, like i mentioned.

i put it in startercharacterscripts, what do you mean?
like remove the folder and only the main script?

The startercharacter scripts get cloned in the players character which is a descendant of workspace. And you know what that means, right?