local function J(J)local p=Vector3.new(0,0,0)local A=1 if J:IsA("\077\111\100\101\108")then local G=J:FindFirstChild("\080\108\097\116\101",true)p=G.Position A=G.Size.X/8 else p=J.Position A=J.Size.X/8 end local G=debrisParts[math.random(1,#debrisParts)]:Clone()local W=p G:SetPrimaryPartCFrame(CFrame.new(W))scaleModel(G,A)G.Parent=mapManager.getMap()J:Destroy()return G.PrimaryPart end

local function createDebris(targetPart)
	local pos = Vector3.new(0, 0, 0)
	local scale = 1
	
	if targetPart:IsA("Model") then
		local plate = targetPart:FindFirstChild("Plate", true)
		pos = plate.Position
		scale = plate.Size.X/8
	else
		pos = targetPart.Position
		scale = targetPart.Size.X/8
	end	
	
	local debris = debrisParts[math.random(1, #debrisParts)]:Clone()
	--local pos2 = getPositionRelativetoBase(debris.PrimaryPart, pos)
	local pos2 = pos
	debris:SetPrimaryPartCFrame(CFrame.new(pos2))
	scaleModel(debris, scale)
	debris.Parent = mapManager.getMap()
	
	targetPart:Destroy()
	
	return debris.PrimaryPart
end
