i am a complete beginner, i'm just following a few youtube tutorials to make a button that plays music
the words "function" "local" "while" "do" and "end" are all in red, and i'm really not sure how to fix it. it asked if i had made sure to close "do" at line 7, and i have absolutely no idea what that means. can someone explain to me in layman's terms what i'm doing wrong and how to fix it?
game.Workspace["click detector event"].onServerEvent:connect(function()
local musicFolder = game.ReplicatedStorage.Music
local availableMusic = musicFolder:GetChildren()
local currentTrack = game.ReplicatedStorage.CurrentTrack
while true do
local randomTrack = availableMusic [math.random(1,#availableMusic)]
currentTrack = "..." -- nothing is playing yet
wait(1) -- delay before next song
randomTrack:Play()
currentTrack.Value = randomTrack.Name
wait(randomTrack.TimeLength)
end)

1 comment
I'm not sure what your settings are for the color schemes in code but unless there is an underline, only then it's a problem, otherwise you are doing everything fine. All I really see is, you need an extra "end" behind "end)", exactly how I spelled it. Also I'm assuming the rest of the code won't work because of line 9