local N local K=game:GetService("\080\108\097\121\101\114\115")while true do N=false for K,o in next,K:GetPlayers()do if o.Character and o.Character.PrimaryPart then local K=(o.Character.PrimaryPart.CFrame.Position-banto.PrimaryPart.CFrame.Position).Magnitude if K>=500 then N=true break end end end if N then task.wait(math.random(8,12.0))continue end bp.Parent=banto.PrimaryPart local o repeat local N=Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether),100,origin.p.z+math.random(-tether,tether)),Vector3.new(0,-1000,0))local K,l,S,A=workspace:FindPartOnRay(N,banto)if K==workspace.Terrain and A~=Enum.Material.Water then o=l+Vector3.new(0,2.25,0)end wait()until o walk:Play()bg.CFrame=CFrame.new(banto.PrimaryPart.Position,o)bp.Position=(CFrame.new(banto.PrimaryPart.Position,o)*CFrame.new(0,0,-100)).Position local l=tick()repeat wait(.5)local N=Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))until(banto.PrimaryPart.Position-o).magnitude<10 or tick()-l>10 walk:Stop()bp.Parent=nil wait(math.random(3,8))end

local nearplayer 
local Players = game:GetService("Players")
while true do
	nearplayer = false

	for _,Player in next, Players:GetPlayers() do 
		if Player.Character and Player.Character.PrimaryPart then
			local dis = (Player.Character.PrimaryPart.CFrame.Position - banto.PrimaryPart.CFrame.Position).Magnitude
			if dis >= 500 then
				nearplayer = true
				break
			end
		end
	end

	if nearplayer then
		task.wait(math.random(8, 8 + 8/2))
		continue
	end
	
	
	bp.Parent = banto.PrimaryPart
	local goal
	repeat 
		local ray = Ray.new(
			Vector3.new(origin.p.x+math.random(-tether,tether),100,origin.p.z+math.random(-tether,tether)),
			Vector3.new(0,-1000,0)
		)
		local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		if part == workspace.Terrain and mat ~= Enum.Material.Water then
			goal = pos+Vector3.new(0,2.25,0)
		end
		wait()
	until goal
	-- move the banto to the newfound goal
	walk:Play()
	bg.CFrame = CFrame.new(banto.PrimaryPart.Position,goal)
	bp.Position = (CFrame.new(banto.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).Position

	local start = tick()
	repeat wait(1/2) 
		local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))
		--local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
		--banto:MoveTo(Vector3.new(banto.PrimaryPart.Position.X,pos.Y+2.25,banto.PrimaryPart.Position.Z))
		--bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)

	until (banto.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
	walk:Stop()
	bp.Parent = nil
	wait(math.random(3,8))
end
