In roblox how would I Make a bot/NPC runaway when it gets to close to a player/ other humanoid?
Asked by
8 years ago Edited 8 years ago
How would you make a bot/npc run away from a player if the player gets to close, and when you kill the bot how would you make it drop something, like a brick.
In conclusion how would you reverse a humanoid following you?
I wrote this script but it doesnt seem to work on the bot/NPC
01 | local phase = script.Parent.Phase |
02 | local h = script.Parent.Humanoid |
05 | game.Workspace:WaitForChild( "Player" ) |
06 | local plr = game.Workspace:FindFirstChild( "Player" ) |
07 | if phase.Value = = "Run" then |
08 | script.Parent.Torso.Velocity = plr.Torso.CFrame.lookVector * 16 |
Where would I put the script after the revisions that have been made? (if there were any)
Thanks =)