return function(...)local f=...local C=Instance.new("\077\111\100\101\108")local c=f.Origin or error("\078\111 \111\114\105\103\105\110 \115\101\116\033")local O=f.Radius or 20 local Z=f.Size or Vector3.new(2,2,2)local T=f.Filter or{Parent,Player.Character}local X=f.Amount or 30 local D=f.Lifetime or 3 local V=30 local Y=360/X local W=RaycastParams.new()W.FilterType=Enum.RaycastFilterType.Blacklist W.FilterDescendantsInstances=T for f=1,X,1 do local T=Random:NextNumber(1.35,1.75)local X=TweenInfo.new(T,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)local r=c local U=(r*CFrame.fromEulerAnglesXYZ(0,math.rad(V),0))*CFrame.new(O/2+O/2.7,10,0)local b=(r*CFrame.fromEulerAnglesXYZ(0,math.rad(V),0))*CFrame.new(O/2+O/10,10,0)local e=workspace:Raycast(U.Position,Offset,W)local P=workspace:Raycast(b.Position,Offset,W)if e then local f=Instance.new("\080\097\114\116")f.Anchored=true f.CanCollide=false f.CanTouch=false f.Material=e.Material f.Color=e.Instance.Color if e.Instance and e.Instance:IsA("\066\097\115\101\080\097\114\116")then f.Transparency=e.Instance.Transparency for C,c in pairs({"\084\111\112\083\117\114\102\097\099\101";"\066\111\116\116\111\109\083\117\114\102\097\099\101","\070\114\111\110\116\083\117\114\102\097\099\101";"\066\097\099\107\083\117\114\102\097\099\101","\082\105\103\104\116\083\117\114\102\097\099\101";"\076\101\102\116\083\117\114\102\097\099\101"})do f[c]=e.Instance[c]end end f.Size=Vector3.new(Z.X*1.3,Z.Y/1.4,Z.Z*1.3)*Random:NextNumber(1,1.5)f.CFrame=CFrame.lookAt(e.Position-Vector3.new(0,.5+(f.Size.Y+1.5),0),c.Position)*CFrame.fromEulerAnglesXYZ(Random:NextNumber(-0.25,.5),Random:NextNumber(-0.25,.25),Random:NextNumber(-0.25,.25))f.Parent=Parent local O=f:Clone()O.Size=Vector3.new(f.Size.X*1.01,f.Size.Y*.25,f.Size.Z*1.01)O.CFrame=f.CFrame*CFrame.new(0,f.Size.Y/2-O.Size.Y/2.1,0)O.Parent=Parent local V=f:Clone()V.CFrame=CFrame.lookAt(P.Position-Vector3.new(0,Z.Y*.4+(f.Size.Y+1.5),0),c.Position)*CFrame.fromEulerAnglesXYZ(Random:NextNumber(-1,-0.3),Random:NextNumber(-0.15,.15),Random:NextNumber(-0.15,.15))V.Parent=Parent local Y=O:Clone()Y.CFrame=V.CFrame*CFrame.new(0,V.Size.Y/2-Y.Size.Y/2.1,0)Y.Parent=Parent f.Parent=C O.Parent=C V.Parent=C Y.Parent=C task.spawn(function()for f,C in pairs(C:GetChildren())do local c=Random:NextNumber(.2,.4)local O=TweenInfo.new(c,Enum.EasingStyle.Back,Enum.EasingDirection.Out);(TweenService:Create(C,O,{Position=C.CFrame.Position+Vector3.new(0,C.Size.Y+2,0),Transparency=0})):Play()end task.wait(D)for f,C in pairs(C:GetChildren())do(TweenService:Create(C,X,{Position=C.CFrame.Position-Vector3.new(0,C.Size.Y+2,0);Transparency=1})):Play()end task.wait(T)C:Destroy()end)end V+=Y end C.Parent=Parent end

return function( ... )
	
	-- Tables
	local Parameters = ...
	local PartsModel = Instance.new("Model")
	
	-- Properties
	local Origin = Parameters.Origin or error('No origin set!')
	local Radius = Parameters.Radius or 20
	local Size = Parameters.Size or Vector3.new(2, 2, 2)
	local Filter = Parameters.Filter or { Parent, Player.Character }
	local Amount = Parameters.Amount or 30
	local Lifetime = Parameters.Lifetime or 3
	
	-- Angles
	local Angle = 30
	local OtherAngle = 360 / Amount
	
	-- Raycast Parameters
	local RaycastParameters = RaycastParams.new()
	RaycastParameters.FilterType = Enum.RaycastFilterType.Blacklist
	RaycastParameters.FilterDescendantsInstances = Filter
	
	-- Main function for rocks
	for _ = 1, Amount do
		local Time = Random:NextNumber(1.35, 1.75)
		local Info = TweenInfo.new(Time, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		
		local CF = Origin
		local NewCFOuter = CF * CFrame.fromEulerAnglesXYZ(0, math.rad(Angle), 0) * CFrame.new(Radius / 2 + Radius / 2.7, 10, 0)
		local NewCFInner = CF * CFrame.fromEulerAnglesXYZ(0, math.rad(Angle), 0) * CFrame.new(Radius / 2 + Radius / 10, 10, 0)

		local OuterRaycast = workspace:Raycast(NewCFOuter.Position, Offset, RaycastParameters)
		local InnerRaycast = workspace:Raycast(NewCFInner.Position, Offset, RaycastParameters)
		
		if OuterRaycast then
			-- Outer Rocks
			local Part = Instance.new('Part')
			Part.Anchored = true
			Part.CanCollide = false
			Part.CanTouch = false
			Part.Material = OuterRaycast.Material
			Part.Color = OuterRaycast.Instance.Color
			
			if OuterRaycast.Instance and OuterRaycast.Instance:IsA("BasePart") then
				Part.Transparency = OuterRaycast.Instance.Transparency
				
				for _, s in pairs({"TopSurface", "BottomSurface", "FrontSurface", "BackSurface", "RightSurface", "LeftSurface"}) do
					Part[s] = OuterRaycast.Instance[s]
				end
			end
			
			Part.Size = Vector3.new(Size.X * 1.3, Size.Y/1.4, Size.Z * 1.3) * Random:NextNumber(1, 1.5)
			Part.CFrame = CFrame.lookAt(OuterRaycast.Position - Vector3.new(0, 0.5 + (Part.Size.Y + 1.5), 0), Origin.Position) * CFrame.fromEulerAnglesXYZ(Random:NextNumber(-0.25, 0.5), Random:NextNumber(-0.25, 0.25), Random:NextNumber(-0.25, 0.25))
			
			Part.Parent = Parent
			
			local Hoof = Part:Clone()
			Hoof.Size = Vector3.new(Part.Size.X * 1.01, Part.Size.Y * 0.25, Part.Size.Z * 1.01)
			Hoof.CFrame = Part.CFrame * CFrame.new(0, Part.Size.Y / 2 - Hoof.Size.Y / 2.1, 0)
			Hoof.Parent = Parent
			
			-- Inner Rocks
			local InnerPart = Part:Clone()
			InnerPart.CFrame = CFrame.lookAt(InnerRaycast.Position - Vector3.new(0, Size.Y * 0.4  + (Part.Size.Y + 1.5), 0), Origin.Position) * CFrame.fromEulerAnglesXYZ(Random:NextNumber(-1 ,-0.3), Random:NextNumber(-0.15, 0.15), Random:NextNumber(-0.15, 0.15))
			InnerPart.Parent = Parent
			
			local InnerHoof = Hoof:Clone()
			InnerHoof.CFrame = InnerPart.CFrame * CFrame.new(0, InnerPart.Size.Y / 2 - InnerHoof.Size.Y / 2.1, 0)
			InnerHoof.Parent = Parent
			
			Part.Parent = PartsModel
			Hoof.Parent = PartsModel
			InnerPart.Parent = PartsModel
			InnerHoof.Parent = PartsModel
			
			-- Remove the rocks when their lifetime is up.
			task.spawn(function()	
				for _, p in pairs(PartsModel:GetChildren()) do
					--local r = p.CFrame - p.Position
					--p.CFrame = CFrame.new(p.Position.X, p.Position.Y, p.Position.Z) * CFrame.new(0, -(p.Size.Y + 2), 0) * r
					--p.Position = p.Position - Vector3.new(0, ( p.Size.Y + 2), 0)
					local Time = Random:NextNumber(0.2, 0.4)
					local Info = TweenInfo.new(Time, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
					TweenService:Create(p, Info, {Position = p.CFrame.Position + Vector3.new(0, ( p.Size.Y + 2 ), 0), Transparency = 0}):Play()
				end
				
				task.wait(Lifetime)

				for _, p in pairs(PartsModel:GetChildren()) do
					TweenService:Create(p, Info, {Position = p.CFrame.Position - Vector3.new(0, ( p.Size.Y + 2 ), 0), Transparency = 1}):Play()
				end
				
				task.wait(Time)

				PartsModel:Destroy() 
			end)
		end
		
		Angle += OtherAngle
	end
	
	PartsModel.Parent = Parent
end
