In my town game, I have NPCs that wander a certain area during the day, and then go to their homes at night. I'd like for them to be able to go through a door but not let anyone else through.
Currently my system is a touchedbased system with the door that turns off CanCollide when touched by the NPC. I have the wait() as low as possible to still allow the NPC through, but a really dedicated player could still get through if they waited for the NPC and tried to run through the door at the exact same moment.
I've made other doors before that only allow certain players through by using a local script, but that wouldn't be possible with an NPC, correct? Is there a way to make something local for an NPC model or another way to allow only the NPC through?

2 comments
Thank you!! I hadn't heard of collision groups before, and after looking up a tutorial on how they work, I was able implement it. No more players sneaking into NPC houses!
You're welcome!