function module.Create(x,C,n,k,M)local T=Instance.new("\077\111\100\101\108",workspace.Terrain)T.Name="\068\101\098\114\105\115"Debris:AddItem(T,5)local i=C.Y local t local e local L local V={}for x,C in pairs(workspace:GetDescendants())do if C.Name=="\068\101\098\114\101\101"or C:FindFirstChildWhichIsA("\072\117\109\097\110\111\105\100")then table.insert(V,C)end end local b=RaycastParams.new()b.FilterDescendantsInstances=V b.FilterType=Enum.RaycastFilterType.Blacklist local d=workspace:Raycast(C+Vector3.new(0,.1,0),Vector3.new(0,-999,0),b)if d then i=d.Position.Y t=d.Material e=d.Instance.Transparency L=d.Instance.Color end local J={}for x=0,x*8,n do table.insert(J,Instance.new("\080\097\114\116",T))end local function I(C)local n=math.cos(C)*x local k=math.sin(C)*x return n,k end for x,M in pairs(J)do M.Anchored=true M.Name="\068\101\098\114\101\101"M.Size=Vector3.new(0,0,0)local T=(x*n)*(360/#J)local t,e=I(T)table.insert(V,M)b.FilterDescendantsInstances=V M.CFrame=CFrame.new(C)*CFrame.new(t,0,e)M.Position=Vector3.new(M.Position.X,i,M.Position.Z)M.CFrame*=CFrame.Angles(math.rad(math.random(-90,90)),math.rad(math.random(-90,90)),math.rad(math.random(-90,90)))if AccurateRepresentation==true then local x=workspace:Raycast(M.Position+Vector3.new(0,.1,0),Vector3.new(0,-999,0),b)if x then M.Material=x.Material M.Transparency=x.Instance.Transparency M.Color=x.Instance.Color else end else M.Material=Materials[math.random(1,#Materials)]M.Color=Colors[math.random(1,#Colors)]end M.Parent=workspace;(TS:Create(M,TweenInfo.new(.2),{Size=Vector3.new(n,n,n)})):Play()task.spawn(function()task.wait(k);(TS:Create(M,TweenInfo.new(.1),{Size=Vector3.new(0,0,0)})):Play()Debris:AddItem(M,.11)end)end for x=0,M,1 do local M=Vector3.new(math.random(-50,50),math.floor(70,120),math.random(-50,50))local i=Instance.new("\080\097\114\116",T)i.CanCollide=false i.Size=Vector3.new(0,0,0)i.Massless=true i.Name="\068\101\098\114\101\101";(TS:Create(i,TweenInfo.new(.2),{Size=Vector3.new(n,n,n)})):Play()if AccurateRepresentation==true then i.Material=t i.Transparency=e i.Color=L else i.Material=Materials[math.random(1,#Materials)]i.Color=Colors[math.random(1,#Colors)]end i.Position=C+Vector3.new(0,n,0)i.Velocity=M i.AssemblyAngularVelocity=Vector3.new(math.random(-90,90),math.random(-90,90),math.random(-90,90))task.spawn(function()wait(.5)i.CanCollide=FlyingDebrisCollision end)task.spawn(function()task.wait(k);(TS:Create(i,TweenInfo.new(.5,Enum.EasingStyle.Cubic),{Size=Vector3.new(0,0,0)})):Play()Debris:AddItem(i,1)end)end return end return module


function module.Create(radius,Position,rockSize, DespawnTime, AmountFlyingDebris)
	local ModelCircle = Instance.new("Model",workspace.Terrain)
	ModelCircle.Name = "Debris"
	Debris:AddItem(ModelCircle,5)
	
	local Y = Position.Y

	local Material
	local Transparency 
	local Color

	local IgnoreList = {}

	for _,object in pairs(workspace:GetDescendants()) do
		if object.Name == "Debree" or object:FindFirstChildWhichIsA("Humanoid") then
			table.insert(IgnoreList,object)
		end
	end

	local RPParams = RaycastParams.new()
	RPParams.FilterDescendantsInstances = IgnoreList
	RPParams.FilterType = Enum.RaycastFilterType.Blacklist

	local ray = workspace:Raycast(Position + Vector3.new(0,0.1,0),Vector3.new(0,-999,0),RPParams)

	if ray then
		Y = ray.Position.Y
		Material = ray.Material
		Transparency = ray.Instance.Transparency
		Color = ray.Instance.Color
	end

	local parts = {}

	for i = 0,radius * 8,rockSize do
		table.insert(parts,Instance.new("Part",ModelCircle))
	end

	local function getXAndZPositions(angle)
		local x = math.cos(angle) * radius
		local z = math.sin(angle) * radius
		return x, z
	end
	
	for i, part in pairs(parts) do
		part.Anchored = true
		part.Name = "Debree"
		part.Size = Vector3.new(0,0,0)
		local angle = (i*rockSize) * (360 / #parts)
		local x,z = getXAndZPositions(angle)
		table.insert(IgnoreList,part)
		RPParams.FilterDescendantsInstances = IgnoreList

		part.CFrame = CFrame.new(Position) * CFrame.new(x, 0, z)
		part.Position = Vector3.new(part.Position.X,Y,part.Position.Z)
		part.CFrame *= CFrame.Angles(math.rad(math.random(-90,90)),math.rad(math.random(-90,90)),math.rad(math.random(-90,90)))
						
		if AccurateRepresentation == true then
			local raynew = workspace:Raycast(part.Position + Vector3.new(0,0.1,0),Vector3.new(0,-999,0),RPParams)

			if raynew then
				part.Material = raynew.Material
				part.Transparency = raynew.Instance.Transparency
				part.Color = raynew.Instance.Color
			else
				--part.Material = Material
				--part.Transparency = Transparency
				--part.Color = Color
			end
		else
			part.Material = Materials[math.random(1,#Materials)]
			part.Color = Colors[math.random(1,#Colors)]
		end

		part.Parent = workspace
		TS:Create(part,TweenInfo.new(0.2),{Size = Vector3.new(rockSize,rockSize,rockSize)}):Play()
		
		task.spawn(function()
			task.wait(DespawnTime)
			TS:Create(part,TweenInfo.new(0.1),{Size = Vector3.new(0,0,0)}):Play()
			Debris:AddItem(part,0.11)
		end)
	end

	for i = 0,AmountFlyingDebris do
		local DebrisVelocity = Vector3.new(math.random(-50,50),math.floor(70,120),math.random(-50,50))
		
		local part = Instance.new("Part",ModelCircle)
		part.CanCollide = false
		part.Size = Vector3.new(0,0,0)
		part.Massless = true
		part.Name = "Debree"
		TS:Create(part,TweenInfo.new(0.2),{Size = Vector3.new(rockSize,rockSize,rockSize)}):Play()

		if AccurateRepresentation == true then
			part.Material = Material
			part.Transparency = Transparency
			part.Color = Color
		else
			part.Material = Materials[math.random(1,#Materials)]
			part.Color = Colors[math.random(1,#Colors)]
		end
		
		part.Position = Position + Vector3.new(0,rockSize,0)
		part.Velocity = DebrisVelocity
		part.AssemblyAngularVelocity = Vector3.new(math.random(-90,90),math.random(-90,90),math.random(-90,90))
		
		task.spawn(function()
			wait(0.5)
			part.CanCollide = FlyingDebrisCollision
		end)
		
		task.spawn(function()
			task.wait(DespawnTime)
			TS:Create(part,TweenInfo.new(0.5,Enum.EasingStyle.Cubic),{Size = Vector3.new(0,0,0)}):Play()

			Debris:AddItem(part,1)
		end)
	end
	
	return
end

return module
