I have tried to look at many scripts regarding this but can't understand it. Please comment a script for this.
How can I make a monster that moves when your not looking at it?
1 answer
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.
5 comments
Thank you but i dont know how to use raycasting. Can you teach me that please?
https://devforum.roblox.com/t/raycasting-how-do-i-do-it/186446/2 the third comment down on this page helped me understand how to use raycasting and I think it will help you too.
Thanks ill try it
@mantorok4866 How do I insert a part in front of the players head using script?
Can u friend me on roblox i cant figure this out
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This is not a request site.