I have the code here basically the NPC walks out the house and back in after doorbell is rang. I want it to where only the NPC can go through the door while the Player cannot.
local NPC = script.Parent.Parent.H1.NPC.Humanoid
local NPCMod = script.Parent.Parent.H1['NPC'].Torso
local pos1 = script.Parent.Parent.H1.inPart.Position
local pos2 = script.Parent.Parent.H1.outPart.Position
local door = script.Parent.Parent.H1.Door
deb = true
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
if deb == true then
deb = false
-- NPC moves outside when doorbell clicked
door.CanCollide = false -- I do not like this because the Player can go through the door too!
NPC:MoveTo(pos2)
wait(.25)
NPCMod.Anchored = true
door.CanCollide = true
wait(5)
NPCMod.Anchored = false
-- NPC moves inside after 5 seconds
door.CanCollide = false
NPC:MoveTo(pos1)
wait(.27)
NPCMod.Anchored = true
door.CanCollide = true
deb = true
end
end)

6 comments
Uh, this is half-assed but, you might be able to use FE to your advantage here.
I'm a pretty new scripter so I mean this is all I would know how to do for now... What does FE stand for?
FE = Filtering Enabled
Add the door from a client's localscript.Thus,the door is visible for the player,but not to the NPC.
I like that idea, and it would probably work the best. ^
Thanks for the tips guys I'll try it out! I never thought about making the doors for the client..