ai.Move=function(v,S,f)goalHumanoid=f if goalPos then goalPos=v else goalPos=v spawn(function()ai.State="\084\114\097\099\107\105\110\103"local v local H=time()while goalPos and ai.Humanoid do local u=goalPos if pcall(function()return goalPos.X end)then elseif goalPos:IsA("\066\097\115\101\080\097\114\116")then u=(ai.canSee(goalPos)or not S)and goalPos.Position or nil H=time()elseif goalPos:IsA("\077\111\100\101\108")then u=nil for v,f in pairs(goalPos:GetChildren())do if f:IsA("\066\097\115\101\080\097\114\116")and(ai.canSee(f)or not S)then u=(goalPos:GetModelCFrame()).p H=time()break end end end v=u and(f and u+(u-ai.Model.Torso.Position).unit*10)or u or v or ai.Model.Torso.Position if goalHumanoid and goalHumanoid.Health<=0 or not goalHumanoid and(ai.Model.Torso.Position-v).magnitude<3 or time()-H>3 then goalPos=nil else ai.Humanoid.Jump=objAhead(v)ai.Humanoid:MoveTo(v,workspace.Terrain)if goalHumanoid and(((ai.Model.Torso.Position-(goalPos:GetModelCFrame()).p)*Vector3.new(1,.5,1)).magnitude<3 and time()-lastAttack>attackTime)then attack(goalHumanoid)end end wait(.1)end if ai then ai.State="\073\100\108\101"end end)end end

ai.Move = function(loc, mustSee, humanoid)
	goalHumanoid = humanoid
	if goalPos then
		goalPos = loc
	else
		goalPos = loc
		spawn(function()
			ai.State = "Tracking"
			local lastGoal
			local lastTime = time()
			while goalPos and ai.Humanoid do
				local gp = goalPos
				if pcall(function() return goalPos.X end) then
				elseif goalPos:IsA("BasePart") then
					gp = (ai.canSee(goalPos) or not mustSee) and goalPos.Position or nil
					lastTime = time()
				elseif goalPos:IsA("Model") then
					gp = nil
					for _, bodyPart in pairs(goalPos:GetChildren()) do
						if bodyPart:IsA("BasePart") and (ai.canSee(bodyPart) or not mustSee) then
							gp = goalPos:GetModelCFrame().p
							lastTime = time()
							break
						end
					end
				end
				lastGoal = gp and humanoid and gp + (gp - ai.Model.Torso.Position).unit * 10 or gp or lastGoal or ai.Model.Torso.Position
				if (goalHumanoid and goalHumanoid.Health <= 0) or (not goalHumanoid and (ai.Model.Torso.Position - lastGoal).magnitude < 3) or time() - lastTime > 3 then
					goalPos = nil
				else
					ai.Humanoid.Jump = objAhead(lastGoal)
					ai.Humanoid:MoveTo(lastGoal, workspace.Terrain)
					if goalHumanoid and ((ai.Model.Torso.Position - goalPos:GetModelCFrame().p) * Vector3.new(1,.5,1)).magnitude < 3 and time() - lastAttack > attackTime then
						attack(goalHumanoid)
					end
				end
				wait(.1)
			end
			if ai then
				ai.State = "Idle"
			end
		end)
	end
end



