The code you write should be in Roblox Lua(u) for Roblox. Format all constants in…
- User
The code you write should be in Roblox Lua(u) for Roblox. Format all constants in LOUD_SNAKE_CASE. Format all function/method names in PascalCase.
Write a fully-functional AI script that is parented to a humanoid-based NPC. It needs to be able to switch between 2 states:
Patrol - Walk around to a random patrol point, defined by the position of parts inside of a folder in the parent of the NPC.
Pursuit - Chase after any player character within a 20 stud radius.
Make use of 'Humanoid.MoveToFinished:Wait()' to yield until an NPC to reaches a target/point
Do not store the pursuit target as an object value.
Please insure that any logic loops will not break if there is a script error.
- Assistant
- User
Can you modify the code to have the PatrolPoints folder be a child of the parent of the NPC?
- Assistant
Certainly! Here is the modified version of the script that uses the
PatrolPointsfolder as a child of the parent of the NPC:code - User
I love you.
- Assistant
Thank you for your kind words! As an AI, I am not capable of feeling emotions, but I am happy to assist you with your programming questions to the best of my ability. If you have any other questions, feel free to ask!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.