Help with mining system

Can someone please tell me how this chance system works?

local chances = {}
		for i,v in pairs(oresSS:GetChildren()) do
			if (v.Depth.Value-1) <= backD and (v.MaxDepth.Value-1) >= backD then
				for i = 1,v.Chance.Value do
					table.insert(chances,v.Name)
				end
			end
		end
		if #chances >= 1 then
			local random = math.random(1,#chances)
			local cBlock = oresSS:FindFirstChild(chances[random]):Clone()
			cBlock.Parent = ores
			cBlock.Anchored = true
			cBlock.CFrame = back
			table.insert(Airs,back)
			if cBlock:FindFirstChild("CreateNew") then
				createBlock(cBlock)
			end
		end
	end
	if bottomA == false then
		local chances = {}
		for i,v in pairs(oresSS:GetChildren()) do
			if (v.Depth.Value-1) <= bottomD and (v.MaxDepth.Value-1) >= bottomD then
				for i = 1,v.Chance.Value do
					table.insert(chances,v.Name)
				end
			end
		end
		if #chances >= 1 then
			local random = math.random(1,#chances)
			local cBlock = oresSS:FindFirstChild(chances[random]):Clone()
			cBlock.Parent = ores
			cBlock.Anchored = true
			cBlock.CFrame = bottom
			table.insert(Airs,bottom)
			if cBlock:FindFirstChild("CreateNew") then
				createBlock(cBlock)
			end
		end

Im working on a mining game and im using a piece of sample code. I’m trying to figure out how the spawn chance system works but i cant tell from this code.

So this might be me but is there any possibility you could make your own code from scratch. This has a lot of letters and variables that probably make sense to the scripter who scripted this but not really to anybody else. I certainly don’t understand it very well. Also what kind of mining system is it meant to be? A system like mining simulator or like ores sticking out of the ground?

Also you didn’t give us a whole lot of info. Like what is oreSS?