Invalid argument #3 to 'clamp' (max must be greater than or equal to min) when using playbackloudness for color3rgb

alr sure

local part = workspace.parts["Club Floor"]
local sound = workspace.Sound
while wait(0.01) do
	part.Color = Color3.fromRGB(math.floor(math.clamp(sound.PlaybackLoudness, 9, 27)), 137, 207)
end	
--9, 137, 207
local part = workspace.parts["Club Floor"]
local sound = workspace.Sound
while task.wait(0.01) do
    local Red = math.floor(math.clamp(sound.PlaybackLoudness, 12, 27) / 3)
    local Green = 175 - math.floor(math.clamp(sound.PlaybackLoudness, 0, 38))
    local Blue = 236 - math.floor(math.clamp(sound.PlaybackLoudness, 0, 29))

    part.Color = Color3.fromRGB(Red, Green, Blue)
end

sorry it took forever, can’t test this code atm
but it should be within those colors hopefully, try to see if it works

If you want to transition one colour to another based on the playback loudness, why not just use :Lerp?

local firstColor = Color3.fromRGB() -- Values here
local secondColor = Color3.fromRGB() -- Values here
local alpha = sound.PlaybackLoudness / Volume to reach second color
part.Color = firstColor:Lerp(secondColor, alpha) -- This will transition from one colour to another

PlaybackLoundess is not a valid member of Sound “Workspace.Sound”

I get this error. Yes, I have the sound in my workspace

if you read this, you will realize it is only a grammar error

PlaybackLoudness

1 Like