So to expand, i created a random sound player, but it does not work.
It's not playing the music. I hope there is an easy solution for this...
ERROR: Attempt to index number with "Play"
local Musics = game.Workspace.Music:GetChildren() local RandomMap = math.random(1, #Musics) RandomMap:Play()
Here you go!
local RandomMap = Musics[math.random(1, #Musics)] RandomMap:Play()
The issue is that you were trying to play a number instead of a music track, so you need to remember to use that number to find a music track.
These other answers don't seem to understand that fundamental problem of this question.
Edit: At the time there were multiple answers, someone seems to have deleted theirs.
Edit 2: And now you have multiple answers again.
Edit 3: And now you have only one other answer.
local musicOptions = {soundId1,soundId2} local musicPicked = math.random(1,#musicOptions) --What to do with musicPicked
Try using sound ids instead.