Playbackloudness coloring

Hi, im master. What im trying to do is make a script that can brighten a part color(the part is neon) while keeping the same color, for example…if i play my audio and the brick is black(because the loudness is 0) i want the color to get brighter(for example like white) without changing colors. Overall i want to sync my brick colors to playbackloudness. Ive tried using lerping and tween and it just doesnt work…

game:GetService(“RunService”).RenderStopped:connect(function()
for I, v in pairs(workspace.BlocksFolder:GetChildren())
v.Color = Color3.new((Playbackloudness/15)/255, (Playbackloudness/15)/175,0)
end
end)
2 Likes

You can change the color brightness by adding the same amount to each RGB value

local r,g,b = Part.Color.R, Part.Color.G, Part.Color.B
local Add = 1
Part.Color = Color3.fromRGB(r+Add,g+Add,b+Add)

Thank you, i was able to do it…

What was your attempt there? Not seeing it in your thread.

local To = Color3.fromRGB(PlaybackLoudness/15, PlaybackLoudness/10, 0)
local From = Color3.new(0, 0, 0)
local Adjusted = From:Lerp(To)

By the way, two comments on your code:

  • Use Heartbeat instead of RenderStepped. Don’t use RenderStepped if you aren’t updating the camera or something very small in the character (e.g. transparency for zooming).

  • Use ipairs. GetChildren returns an array. ipairs is for iterating arrays.

My apologies, i forgot to post my attempt…im new to devforums.