Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Part size change on sound PlaybackLoudness doesnt work?

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

1 answer

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

3 comments

0

So the playback loudness i supposed to go with the part size, so the part would change size based on the bass and loudness of the audio being played

0

Add more info so we can work to help you, what is a mus exactly, what do you want the script to do exactly, etc etc

0

okay 1 sec, il update the question

This discussion is preserved as it was. New answers, comments, and votes are closed.