Well Im remaking the known game BLOXore and Im changing the monsters up I need to figure out to change there ai so the player cant just stand and do dmg,Becuase I want the AI to allow the monster to jump over the player and attack from behind and such,Thats all thanks for reading this!
local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 15
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) and game.Players:GetPlayerFromCharacter(temp2)~=nil then
temp = temp2:findFirstChild("Right Arm")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
while true do
wait()
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end
end
Thats the script I belive is the problem

4 comments
@Validark Added the codeblock
Er... Isn't this in free models? Correct me if I'm wrong.
If you want jumping and stabbing and such sorry to tell you but you'll need more precise questions and you'll also need to figure a couple things out yourself because this is not a request forums.
This is not a model