So i have this script that selects a random song from lighting and drops it into a folder in workspace to play it. I also have an audio visualiser (Its a part/mesh part) in my game that is supposed to go off of the songs played in the folder, but i really don't know where I've gone wrong. some help would be highly appreciated
(More info) "mus" is the name of the folder in workspace. (i name my stuff weirdly, sorry.) i used "mus" as the place holder in the script the script is inside a part, the script is supposed to take the playback loudness of the song in the "mus" folder and use that to resize the part, working as a visualiser. {idk if this helped or not, im bad at explaining} ()
The Script that is inside the visualiser that is supposed to go off of the songs in the folder:
mus = game.Workspace.mus:GetChildren() while true do for _,v in pairs(mus.PlaybackLoudness) do script.Parent.Size = Vector3.new(mus/math.random(30,80),1.119,3.883) wait() end end
for _,v in pairs(mus.PlaybackLoudness) do
You need a table in the column not a value So it should be this instead :
for _,v in pairs(mus) do
What do u intend to use the .PlaybackLoudness for anyway, and if you gonna use a while loop, why bother using a for loop when you didnt use "_" or "v"
Edit : this is probably what u need, just replace the for loop part with this
for _,v in pairs(mus) do script.Parent.Size = Vector3.new(v.PlaybackLoudness/math.random(30,80),1.119,3.883) wait() end