Can someone help me with the marching cubes algorithm?(Perlin noise)

So basically i neeed a hand with this perlin noise thing i Have everything else set up correctly(as far as i know.) Ive tried google and ive been on this little Marching Cubes Project for days so ive been doing a lot of research yet I cant crack perlin noise.

local Scale = 1
local seed = math.random(100,800)/1000
local s = math.random(2,8)/100
local res = 100
local terrain_data = {}
local GridData = {}
local Points = {}
local MarchingModule = require(script.Parent.MarchingCubesAlgorithm)
local TriangleTable = MarchingModule.TriTable()
local EdgeTable = MarchingModule.EdgeTable()
local function Grid(Object, NumberAmountTable, Scale)
	local Number = 0
	for X = 0, NumberAmountTable.X*Scale do
		terrain_data[X] = {}
		GridData[X] = {}
		for Y = 0, NumberAmountTable.Y*Scale do
			terrain_data[X][Y] = {}
			GridData[X][Y] = {}
			for Z = 0, (NumberAmountTable.Z)*Scale do
				local Density = math.noise(X * s, Y * s, Z * s, seed)

It tends to make a shell like shape and thats all i know

1 Like