i need help, right now i have a few NPC's running around with scripts for their ai and i usually like to do all the scripting myself and learn from other players scripts, but i can not find a script close to what im looking for, i need the script to detect if a players torso is within say 10 blocks of the npc's torso and have him look at it heres my script soo far, any help?
torso = script.Parent:findFirstChild("Torso")
ai1 = script.Parent.AI.Disabled
ai2 = script.Parent.AI2.Disabled
for i, plr in ipairs(game.Players:GetChildren()) do
--NEED WAY TO SENSE plr's TORSO DISTANCE FROM AI TORSO
if ai2 == false then
if plr:GetRankInGroup(1129497) >= 250 then
ai2 = true
--NEED WAY TO MAKE MODEL LOOK AT PLAYER
end
end
if ai1 == false then
if plr:GetRankInGroup(1129497) >= 250 then
ai1 = true
--NEED WAY TO MAKE MODEL LOOK AT PLAYER
end
end
end
ps. i want it when a High rank in my group walks by they look at him hense why theres a rank sensor

1 comment
Thanks yeah i can adapt this