I am very new to scripting and this is what i'm trying to do. I'm trying to make a strobe light essentially, and i want the loudness of the music (Preferably the low end of the music) to trigger a switch in the color and material of the brick. The sound file is under workspace/MusicScript/S1
MusicScript is the script that is playing a playlist of songs, and S1 is the sound file.
In the workspace, i added a new script to try to make the light work, and this is the script
" game:GetService("RunService").RenderStepped:connect(function()
local loudness = game.Workspace.MusicScript.S1.Volume if loudness >= 350 then game.workspace.StrobeBrick.Material = "Neon" game.workspace.StrobeBrick.BrickColor = BrickColor.new "Mid grey" else game.workspace.StrobeBrick.Material = "Neon" game.workspace.StrobeBrick.BrickColor = BrickColor.new "Really black" end
end) "
Is there anything i'm missing? or any terms i've used wrong? Thank you!
What you did wrong is you used the wrong property of the sound to get the loudness of it. If you simply change the last part of line 1 from Volume to PlaybackLoudness, it should work just fine. The volume property effects the loudness of the sound, but it doesn't return it.