I would like to make an image change size to the music

The only problem is, depending on the song, it might not work.

Thank you both @BreadyToCrumble and @AdvancedDrone for helping me :slight_smile:

1 Like

You can create a table of songs you plan on using and setting the bounds for each one.

local songs = {
    {"rbxassetid://whatever", 0.2, 0.5}
}

sound.SoundId = songs[1][1]
sound:Play()

local amplitude = math.clamp(sound.PlaybackLoudness/1000, songs[1][2], songs[1][3])
script.Parent.Size = UDim2.new(amplitude, 0, amplitude, 0)

This way, as you add in more songs, you can just consult the table. This implementation isn’t the best, but you can adapt it to your needs. If you’re creating a playlist, you can loop through the table and use indices 1-3 to grab the info you need.

2 Likes

You should mark a solution so it’s easy for other people to find the post that was most helpful. You can click the checkmark in the bottom right of whichever post solved your problem.

2 Likes