Player and NPC doors not working?
Hello.
I am currently trying to make a door that is both openable by an NPC, and the Player itself. Now, I am quite unsure how to fully make an NPC open a door, so instead, I made it so for the NPC, the door would open on touch, and for players, they'd have to click it. And this works, however the issue that I am having is that players can also open the door when touching them. I am unsure why this is being caused.
I have 2 scripts in the door, one to open the door by click (for the player) and one to open the door by touch (for the NPC). Now, of course, with this, it would do that because both scripts are running at the same time. I attempted to fix that by having a LocalScript in StarterCharacters scripts, that upon join, it would delete the door open touch script for the player only (locally).
However, that didn't work, and even after the script being removed for the player, the player could still open the door on touch even if the open door on touch script was deleted for the player.
I am quite unsure as to why this happens.
Here is the script:
1 | local Door = workspace:WaitForChild( "BedroomDoor" ) |
2 | local NPCOpenDoorScript = Door:WaitForChild( "NPCDoorHandler" ) |
5 | NPCOpenDoorScript:Destroy() |
If I could get some help with this, it would be great.
Thanks!