Figure=script.Parent RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")Creator=Figure:FindFirstChild("\067\114\101\097\116\111\114")Humanoid=Figure:WaitForChild("\072\117\109\097\110\111\105\100")Torso=Figure:WaitForChild("\084\111\114\115\111")Healing=Figure:WaitForChild("\072\101\097\108\105\110\103")FollowingPath=false WalkRadius=25 WalkingPaused=false OriginallyIgnored=false Humanoid.Health=Humanoid.MaxHealth function RayCast(J,q,Y,d)return(game:GetService("\087\111\114\107\115\112\097\099\101")):FindPartOnRayWithIgnoreList(Ray.new(J,q.unit*(Y or 999.999)),d)end function MoveAround(J)J=not J and Torso.Position+Vector3.new(math.random(-WalkRadius,WalkRadius),0,math.random(-WalkRadius,WalkRadius))or J Humanoid:MoveTo(J)end function SecureJump()if Humanoid.Jump then return end local J=Humanoid.TargetPoint local q,Y=RayCast((Torso.CFrame+(CFrame.new(Torso.Position,Vector3.new(J.X,Torso.Position.Y,J.Z))).lookVector*(Torso.Size.Z/2)).p,Torso.CFrame.lookVector,Torso.Size.Z*2.5,{Figure,(Creator and(Creator.Value and(Creator.Value:IsA("\080\108\097\121\101\114")and Creator.Value.Character)))and Creator.Value.Character or nil})local d=false if q then d=true if q:IsA("\084\101\114\114\097\105\110")then local J=q:WorldToCellPreferSolid(Y-Vector3.new(0,2,0))local Q,G,P=q:GetCell(J.X,J.Y,J.Z)if Q==Enum.CellMaterial.Water then d=false end elseif q.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")then d=false end end if d then Humanoid.Jump=true end end RunService.Stepped:connect(function()if WalkingPaused then return end local J=false local q=false local Y=Creator and Creator.Value or nil local d,Q,G local P if Y and(Y:IsA("\080\108\097\121\101\114")and Y.Character)then d=Y.Character Q=d:FindFirstChild("\084\111\114\115\111")if Q then P=(Torso.Position-Q.Position).magnitude G=Q.CFrame+Q.CFrame.lookVector*(Q.Size.Z*(not Healing.Value and-0.25 or-1.5))if not Healing.Value then G=(G+(G*CFrame.Angles(0,math.pi/2,0)).lookVector*(Torso.Size.X*1.5)).p else G=G.p q=true OriginallyIgnored=true end end end if P then if P>6 or q or OriginallyIgnored then if not q then OriginallyIgnored=false end if Humanoid.Sit then Humanoid.Jump=true end local J=(Q and(Torso.Position-Q.Position).magnitude>=20)and 24 or 16 Humanoid.WalkSpeed=J MoveAround(G)end else MoveAround(nil)J=true end SecureJump()if J then WalkingPaused=true local J={Min=1;Max=3}J={Min=J.Min*100;Max=J.Max*100}local q=math.random(J.Min,J.Max)*.01 wait(q)WalkingPaused=false end end)


Figure = script.Parent

RunService = game:GetService("RunService")

Creator = Figure:FindFirstChild("Creator")

Humanoid = Figure:WaitForChild("Humanoid")
Torso = Figure:WaitForChild("Torso")

Healing = Figure:WaitForChild("Healing")

FollowingPath = false
WalkRadius = 25

WalkingPaused = false
OriginallyIgnored = false

Humanoid.Health = Humanoid.MaxHealth

function RayCast(Position, Direction, MaxDistance, IgnoreList)
	return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList) 
end

function MoveAround(TargetPoint)
	TargetPoint = ((not TargetPoint and (Torso.Position + Vector3.new(math.random(-WalkRadius, WalkRadius), 0, math.random(-WalkRadius, WalkRadius))) or TargetPoint))
	Humanoid:MoveTo(TargetPoint)
end

function SecureJump()
	if Humanoid.Jump then
		return
	end
	local TargetPoint = Humanoid.TargetPoint
	local Blockage, BlockagePos = RayCast((Torso.CFrame + CFrame.new(Torso.Position, Vector3.new(TargetPoint.X, Torso.Position.Y, TargetPoint.Z)).lookVector * (Torso.Size.Z / 2)).p, Torso.CFrame.lookVector, (Torso.Size.Z * 2.5), {Figure, (((Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character) and Creator.Value.Character) or nil)})
	local Jumpable = false
	if Blockage then
		Jumpable = true
		if Blockage:IsA("Terrain") then
			local CellPos = Blockage:WorldToCellPreferSolid((BlockagePos - Vector3.new(0, 2, 0)))
			local CellMaterial, CellShape, CellOrientation = Blockage:GetCell(CellPos.X, CellPos.Y, CellPos.Z)
			if CellMaterial == Enum.CellMaterial.Water then
				Jumpable = false
			end
		elseif Blockage.Parent:FindFirstChild("Humanoid") then
			Jumpable = false
		end
	end
	if Jumpable then
		Humanoid.Jump = true
	end
end

RunService.Stepped:connect(function()
	if WalkingPaused then
		return
	end
	local Wait = false
	local IgnoreDistance = false
	local CreatorValue = ((Creator and Creator.Value) or nil)
	local CreatorCharacter, CreatorTorso, TorsoPosition
	local DistanceApart
	if CreatorValue and CreatorValue:IsA("Player") and CreatorValue.Character then
		CreatorCharacter = CreatorValue.Character
		CreatorTorso = CreatorCharacter:FindFirstChild("Torso")
		if CreatorTorso then
			DistanceApart = (Torso.Position - CreatorTorso.Position).magnitude
			TorsoPosition = (CreatorTorso.CFrame + CreatorTorso.CFrame.lookVector * (CreatorTorso.Size.Z * ((not Healing.Value and -0.25) or -1.5)))
			if not Healing.Value then
				TorsoPosition = (TorsoPosition + (TorsoPosition * CFrame.Angles(0, (math.pi / 2), 0)).lookVector * (Torso.Size.X * 1.5)).p
			else
				TorsoPosition = TorsoPosition.p
				IgnoreDistance = true
				OriginallyIgnored = true
			end
		end
	end
	if DistanceApart then
		if DistanceApart > 6 or IgnoreDistance or OriginallyIgnored then
			if not IgnoreDistance then
				OriginallyIgnored = false
			end
			if Humanoid.Sit then
				Humanoid.Jump = true
			end
			local WalkSpeed = (((CreatorTorso and (Torso.Position - CreatorTorso.Position).magnitude >= 20) and 24) or 16)
			Humanoid.WalkSpeed = WalkSpeed
			MoveAround(TorsoPosition)
		end
	else
		MoveAround(nil)
		Wait = true
	end
	SecureJump()
	if Wait then
		WalkingPaused = true
		local RandomInterval = {Min = 1, Max = 3}
		RandomInterval = {Min = (RandomInterval.Min * 100), Max = (RandomInterval.Max * 100)}
		local WaitTime = (math.random(RandomInterval.Min, RandomInterval.Max) * 0.01)
		wait(WaitTime)
		WalkingPaused = false
	end
end)
