Need help making gertsner waves!

I tried following this step-by-step guide but failed to achieve the same results.

really sorry for the noise in the background :sweat_smile:
also forgot to mention it but the script I have so far is – ( this script is parented to a meshpart )
local assetService = game:GetService(“AssetService”)

local object = script.Parent
local editableMesh = Instance.new(“EditableMesh”)
editableMesh.Parent = object

local WIDTH = 100
local HEIGHT = 100

–local wave_length = 50
–local amplitude = 5
–local speed = 50
–local dir = Vector2.new(1, 1)

local offset = 1

local vertices = {}

for y = 1, HEIGHT do
local raw = {}
for x = 1, WIDTH do
local vertex_position = Vector3.new(x - 1, 0, y - 1) * offset
local vertex_id = editableMesh:AddVertex(vertex_position)

	editableMesh:SetVertexColor(vertex_id, Color3.new(0.12549, 0.576471, 0.968627))
	
	raw[x] = {vertex_id, vertex_position}
end
vertices[y] = raw

end

for y = 1, HEIGHT-1 do
for x = 1, WIDTH-1 do
local vertex_1 = vertices[y][x][1] :: number
local vertex_2 = vertices[y+1][x][1] :: number
local vertex_3 = vertices[y][x+1][1] :: number

	-- to create a second triangle / square
	local vertex_4 = vertices[y+1][x+1][1] :: number
	
	local triangle_1 = editableMesh:AddTriangle(vertex_1, vertex_2, vertex_3)
	local triangle_2 = editableMesh:AddTriangle(vertex_4, vertex_3, vertex_2)
end

end

–[[dir, steepness, wavelength]]
local waveA = {d = Vector2.new(1, 0), z = 0.5, w = 50}
local waveB = {d = Vector2.new(0, .25), z = 0.25, w = 20}

local function gerstnerWave(wave, p, tangent, binormal)
local steepness = wave.z
local wavelength = wave.w
local ct = os.clock()
local xz = Vector2.new(p.x, p.z)
local k = 2 * math.pi / wavelength
local c = math.sqrt(9.8 / k)
local d = wave.d.Unit
local f = -k * (d:Dot(xz) - c * ct)
local a = steepness / k

tangent += Vector3.new(
	-d.x * d.x * (steepness * math.sin(f)),
	d.x * (steepness * math.cos(f))
	-d.x * d.y * (steepness * math.sin(f))
)
binormal += Vector3.new(
	-d.x * d.y * (steepness * math.sin(f)),
	d.y * (steepness * math.cos(f))
	-d.y * d.y * (steepness * math.sin(f))
)
return Vector3.new(
	d.x * (a * math.cos(f)),
	a * math.sin(f),
	d.x * (a * math.cos(f))
)

end

game:GetService(“RunService”).Heartbeat:Connect(function()
for y = 1, HEIGHT do
for x = 1, WIDTH do
local vertex_id = vertices[y][x][1] :: number

		local function vert()
			local gridPoint = vertices[y][x][2] :: Vector3
			local tangent = Vector3.zero
			local binormal = Vector3.zero
			local p = gridPoint
			p += gerstnerWave(waveA, gridPoint, tangent, binormal)
			p += gerstnerWave(waveB, gridPoint, tangent, binormal)
			editableMesh:SetPosition(vertex_id, p)
		end
		vert()
	end
end

end)