Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Stop NPC from getting to closed?

Asked by 7 years ago

How do I keep my NPC it's called police car and I want it to keep it's distance away from player. It can chased players down but I want it not to get too close to player cars.

01local larm = script.Parent:FindFirstChild("Left Arm")
02local rarm = script.Parent:FindFirstChild("Right Arm")
03 
04function findNearestTorso(pos)
05    local list = game.Workspace:children()
06    local torso = nil
07    local dist = 1000
08    local temp = nil
09    local human = nil
10    local temp2 = nil
11    for x = 1, #list do
12        temp2 = list[x]
13        if (temp2.className == "Model") and (temp2 ~= script.Parent) then
14            temp = temp2:findFirstChild("Right Arm")
15            human = temp2:findFirstChild("Target")
View all 40 lines...

Answer this question