I have tried to look at many scripts regarding this but can't understand it. Please comment a script for this.
there are many ways to do this as making npcs are a multi step process. but because this isnt a request site I will only give you a basic concept to get you started.
first: to give your monster visual site, you can use raycasting, gettouchingparts, or a script with a touch function.
second: you will want an indicator to whether your player is looking at the monster or not. insert a part in front of your player, using this part you can cast a ray in front of you using raycasting. or you can stretch it out. after stretching it out in front of you your left with basically a pole in front of you. this will represent your players visual range and then you can use either GetTouchingParts or a touch function when the part collides with the monster. after that just code the monster so it reacts when said visual part collides with it or not. you can make the visual part fully transparent to make it look good. that all I can give you but it should get you started.
Closed as Not Constructive by DeceptiveCaster, namespace25, and zblox164
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?