Hi there, I have a script that uses lerp to transition between two colors using playbackloudness, however the color stays black (as what the first color is defined to) and doesnt change to the second. I’ve tried changing the number that divides playbackloudness however to no appeal there is no difference.
I’m sorry for those who have seen my activity of posting the same topic, but that’s the sheer determination to get it right.
Script below:
local sound = workspace:WaitForChild("Sound")
local part = workspace.parts["Club Floor"]
local ColorSilent = Color3.fromRGB(0, 0, 0)
local ColorLoud = Color3.fromRGB(10, 162, 243)
part.Color = ColorSilent:Lerp(ColorLoud, sound.PlaybackLoudness / 1000)
It was printing 0 before because you were only reading the value from the property once when the script first executes which is likely before the sound started playing.
local sound = workspace.Sound
local parts = workspace:WaitForChild("parts")
local floor = parts:WaitForChild("Club Floor")
local ColorSilent = Color3.fromRGB(0, 0, 0)
local ColorLoud = Color3.fromRGB(10, 162, 243)
sound:Play()
task.spawn(function()
while task.wait() do
floor.Color = ColorSilent:Lerp(ColorLoud, sound.PlaybackLoudness / 100)
end
end)