ai.Move=function(l,y,S)goalHumanoid=S if goalPos then goalPos=l else goalPos=l Spawn(function()ai.State="\084\114\097\099\107\105\110\103"local l local T=time()while goalPos and ai.Humanoid do local s=goalPos if pcall(function()return goalPos.X end)then elseif goalPos:IsA("\066\097\115\101\080\097\114\116")then s=(ai.canSee(goalPos)or not y)and goalPos.Position or nil T=time()elseif goalPos:IsA("\077\111\100\101\108")then s=nil for l,S in pairs(goalPos:GetChildren())do if S:IsA("\066\097\115\101\080\097\114\116")and(ai.canSee(S)or not y)then s=(goalPos:GetModelCFrame()).p T=time()break end end end l=s and(S and s+(s-ai.Model.Torso.Position).unit*10)or s or l or ai.Model.Torso.Position if goalHumanoid and goalHumanoid.Health<=0 or not goalHumanoid and(ai.Model.Torso.Position-l).magnitude<3 or time()-T>3 then goalPos=nil else ai.Humanoid.Jump=objAhead(l)ai.Humanoid:MoveTo(l,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
--global functions
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, 0.5, 1)).magnitude < 3
						and time() - lastAttack > attackTime
					then
						attack(goalHumanoid)
					end
				end
				wait(0.1)
			end
			if ai then
				ai.State = "Idle"
			end
		end)
	end
end
