Music Script doesn't seem to work correctly

Oh

I believe this might be due to the fact the way you first inserted your songs from? I could be entirely wrong

Could you try setting the ID’s inside a table instead? That may work a bit better, but it’d take a bit more work

It is sorting them alphabetically, not by numbers

you’ll have to pad the numbers that are less than 2 digits:

01
02…
09
10
11
12

if you go to 100 songs, you’ll have to pad 2 zeros

001
002
003…

It compares the tens digit to the ones digit and doesn’t ‘know’ 11 comes after 2.

1 Like

So basically Audio01, Audio02, and so on? or just 01, 02, 03, etc. as the name?

Yes, either one should work, just don’t let your two digit numbers jump ahead of your one digit numbers. The leading 0 should fix that. I’d go ahead and add 00 while you’re at it, in case you go over 100 eventually.

audio001
audio002…

I don’t create sound objects in the workspace for each song in my game radio, I just use the soundid’s and one sound object that I update as I cycle through songs. You may find it easier to keep all your sound id’s and titles in a table or dictionary and have more control over the order?

1 Like

I was thinking about doing this, and I’m beginning to consider it more. I just don’t want to take too much time, thanks for the help, I’ll make these edits.

@Sir_Highness This seems to have fixed the issue, but thank you @Jackscarlett for adding onto the script and ensuring it doesn’t break due to a song that doesn’t load quick enough.

I appreciate the help, and I’ll keep this numbering system in mind, because I had initially thought it didn’t matter if it went up by regulars numbers, not like 01, 02, 03, etc.