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!

2 comments
Oh okay. I did try PlaybackLoudness ass well and it still didn't work, my friend said to use volume. So after both now working i decided to bring it here. I'll keep erring different things until it pulls through thanks for the comment
Whoops, I forgot to say that it needs to be in a LocalScript in order for it to work.