Hi there, I have a club floor I want to change color using playback loudness, however the values I put in lead to an error (I don’t understand what it is). I don’t know how to explain more in depth since I’m new to lua.
Console error
Players.vxsqi.PlayerGui.LocalScript:4: invalid argument #3 to 'clamp' (max must be greater than or equal to min)
Script
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, 27, 9)), 137, 207)
end
looking at this code it seems like you are only changing R(red)
also PlaybackLoudness goes up to 1000 so if it is higher then the “27” that you entered, it will stay at 27
so you could mess with the max number to see what works best
depending on the sound yes, however not just red. This is the default brick color, “4, 175, 236”. I want that color to change through this color, “9, 137, 207” depending on the sound.