function NpcModule.CalculeWalk(X,G,E,m,C)local a=0 if C==nil then a=1.7 else a=C end local h=math.random(-G,G)local B=math.random(-G,G)if h<G/a and h>=0 then h=G/a elseif h>-G/a and h<0 then h=-G/a end if B<G/a and B>=0 then B=G/a elseif B>-G/a and B<0 then B=-G/a end h=X.PrimaryPart.Position.X+h B=X.PrimaryPart.Position.Z+B if E~=nil or m~=nil then if h<E.X then h=E.X elseif h>m.X then h=m.X end if B<E.Z then B=E.Z elseif B>m.Z then B=m.Z end end local l=Vector3.new(h,NpcModule.RayY(h,B,X),B)return l end

function NpcModule.CalculeWalk(NPC, Range, MinVector, MaxVector, Minrange)
	local MinRange = 0
	
	if Minrange == nil then
		MinRange = 1.7
	else
	   MinRange = Minrange
	end
	
	-- Calcules	
	local X = math.random(-(Range), Range)
	local Z = math.random(-(Range), Range)
	
	if X < (Range/MinRange) and X >= 0 then
		X = Range/MinRange
	elseif X > (-Range/MinRange) and X < 0 then
		X = -Range/MinRange
	end
	
	if Z < (Range/MinRange) and Z >= 0 then
		Z = Range/MinRange
	elseif Z > (-Range/MinRange) and Z < 0 then
		Z = -Range/MinRange
	end

	X = NPC.PrimaryPart.Position.X + X
	Z = NPC.PrimaryPart.Position.Z + Z
	
	if MinVector ~= nil or MaxVector ~= nil then
		if X < MinVector.X then
			X = MinVector.X
		elseif X > MaxVector.X then
			X = MaxVector.X
		end

		if Z < MinVector.Z then
			Z = MinVector.Z
		elseif Z > MaxVector.Z then
			Z = MaxVector.Z
		end
	end

	local Pos = Vector3.new(X, NpcModule.RayY(X,Z,NPC) , Z)
	return Pos
end



