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

I cannot figure out why this "list" has a syntax error?

Hello everyone! I am currently working on a script for my game that when a certain button is clicked. It will play a random song for the shop menu. I already know how to use math.random. But, I cannot figure out for the life of me, why this list isn't working. here is the errors I am getting. (Note: I don't receive any errors in the console, only script analysis.)

Errors with code: https://imgur.com/a/cRx7rfS

shopMusicList = {
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_1
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_2
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_3
}

Explorer location: https://imgur.com/a/HheZAeT

If anyone knows the reason and can help me out with this, that would be great. :)

1 comment

0

You are missing commas between your table elements. Beyond that, with the code you have provided, I don't see anything out of place.

1 answer

✓ Accepted answer

##Problem:

You didn't separate the items with a comma in the table. Essentially the code will think that the items in the table aren't needed since the table isn't enclosed at line 15 and hence will cause this error.

##Solution

Remember to separate the items you want in the table with either a comma or a semi-colon and that will fix the error!

##Fixed Script:

shopMusicList = {
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_1,
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_2,
	game.Workspace.Soundtrack.ShopSoundtrack.shopMusic_3,
}

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