How can I make a part's color brighten and dim to the local music?

Hi. Basically, I want the Color of this Wireframe part to brighten and dim depending on how loud the music is, in other words, I want the part color to pulse to the music. I have a basic idea of what i should use, like ‘PlaybackLoudness’, but i’m not sure how to go about it. Any help is greatly appreciated.

image

1 Like

You should use the :Lerp() method that Color3 has. I have an explanation for the Lerp method in my featured topic if you don’t know what it is. What’s the max volume? You’re gonna want to divide the current volume over the max volume to get a percentage, and then you can use this percentage in the Lerp function.

You should have two Color3s, one is the minimum color (the color shown at volume 0) and the maximum color (the color shown at max volume).

local minColor = Color3.fromRGB(0,0,0)
local maxColor = Color3.fromRGB(255,255,255)
while task.wait(0.1) do
       local percent = currentVolume/maxVolume
       local currentColor = minColor:Lerp(maxColor, percent)
       -- more code..
end