local part = workspace:FindFirstChild("Set") -- Part which will be visualised
local sizex = part.Size.X -- Unnecessary if using a fixed value for sizex
local sizez = part.Size.Z -- Unnecessary if using a fixed value for sizey
local positiony = part.Position.Y -- Unnecessary if using a fixed value for positiony
local positionx = part.Position.X -- Unnecessary if using a fixed value for positionx
local positionz = part.Position.Z -- Unnecessary if using a fixed value for positionz
local sound = workspace.Music -- Referring the sound which will be visualised

game:GetService("RunService").RenderStepped:Connect(function()
	local loudness  =  sound.PlaybackLoudness -- Obtains the playback loudness of the sound
	local sizeincrement = loudness/60 -- The Number can be edited, depending on how you want it to behave.
	for i,v in pairs(part:GetChildren()) do
		if v then
			v.Size = Vector3.new(sizex,sizeincrement,sizez)
			v.Position = Vector3.new(positionx,positiony+(sizeincrement/2),positionz)
		end
	end
	
	--part.Size = Vector3.new(sizex, sizeincrement, sizez)
	--part.Position = Vector3.new(positionx, positiony + (sizeincrement/2), positionz) -- Line unnecessary if you want the part to grow on both sides equally.
	-- sizeincrement can be switched to any axis depending on how you want the part to grow (it should be on the same axis as the size line and position line to work dependently)
end)

2 comments

0

I grabbed this in LUA learning in one of the tutorials

0

My goal is to use a group of parts and do its audio visualizer