How do I make a dance floor with noise

How would I make a dance floor with noise and how do I tween it?
I want it to look like this: https://gyazo.com/5d4ae6c66391208a69280e88de9c5b71

I’ve tried to generate a floor with math.noise and changing the frequency.

Current: https://gyazo.com/b4040e4b8d8316ccc41470bbf877d03b
Code:

local tiles = workspace.Tiles

local function generate(p)
	local seed = math.random(1, 50)
	local frequency = p
	local power = 4
	local size = 9
	
	for _, v in pairs(tiles:GetChildren()) do
		v:Destroy()
	end

	for x = 1, size do  
		for z = 1, size do
			local y1 = math.noise((x * frequency) / size, (z * frequency) / size, seed)
			local y2 = math.noise((x * frequency * 0.125) / size, (z * frequency * 0.125) / size, seed)
			local y3 = math.noise((x * frequency * 5) / size,(z * frequency * 5) / size, seed)

			local y = (y1 * y2 * power * power) + y3

			local block = Instance.new("Part")
			block.Name = "Block"
			block.Transparency = 0.75
			block.Anchored = true
			block.CanCollide = false
			block.Material = Enum.Material.SmoothPlastic
			block.Size = Vector3.new(15, 50, 15)
			block.CFrame = CFrame.new(x * 5, y, z * 5) * CFrame.Angles(0, 0, 0)
			block.Parent = tiles
		end
	end

	game:GetService("RunService").Heartbeat:Wait()
end

while true do
	for i = 1, 10, 0.1 do
		generate(i)
		wait(0.1)
	end
end
1 Like

With some work with audio visualiser I’m pretty sure you can get the sounds PlaybackLoudness

PlaybackLoudness returns the actual sound of the music being played. Volume doesn’t affect it but Sound Effects do.

This is how I did my audio visualiser very simple but works very well

If you’re playing music on the client use RenderStepped otherwise put it in a while wait()/true do loop

local sound = -- define where the sound is

game:GetService("RunService").RenderStepped:Connect(function()
   game.Part1.Size = Vector3.new(2, sound.PlaybackLoudness/20, 2)
end)

Hopefully this gives an idea on what you can do

https://gyazo.com/f971bc5771b20a80080827e3a954dc34

1 Like

Instead of having p affect the seed, frequency or anything else, try adding math.sin(p) to the 3rd parameter of math.noise, and have p vary from -math.pi to math.pi, like so:

while true do
	for i = 0, 1, 0.1 do
		generate( -math.pi + math.pi * 2 * i  )
		wait(0.1)
	end
end

I’ve tried PlaybackLoudness before but I want it to move like a wave.

Everytime it goes over a certain value with PlaybackLoudness create a wave

I guess I’ll have to make a 3d audio spectrum.

It works pretty good but how would I sync it with PLaybackLoudness?

https://gyazo.com/389d0e9249fcfc09078e1e5789fd9d5e