Can anyone please help me with my Loop Script? I need help with a music playist on my game!
while true do game.Workspace.MusicOne:Play() --this will play 'MusicOne wait(119) --the time inbetween each song game.Workspace.MusicTwo:Play() wait(119) game.Workspace.MusicThree:Play() --this will play 'MusicOne wait(119) game.Workspace.MusicFour:Play() --this will play 'MusicOne wait(119) game.Workspace.MusicFive:Play() --this will play 'MusicOne wait(119) game.Workspace.MusicSix:Play() --this will play 'MusicOne wait(119) end
This is what i think is a loop script will this loop it?
If you are looking for something to loop and never end while the script is enabled then you will probably want to use the while true do loop like you did in that example. If you are looking for something that will keep looping, but will end if something certain happens then you would want a repeat loop like this:
repeat workspace.MusicOne:Play() wait(119) workspace.MusicTwo:Play() wait(119) workspace.MusicThree:Play() wait(119) workspace.MusicFour:Play() wait(119) workspace.MusicFive:Play() wait(119) workspace.MusicSix:Play() wait(119) until game.Mute.Value == false -- some random example :l
You can also mess around with if statements and the Break command to stop a loop if needed.
Please remember to accept my answer if you feel it helped answer your question. If not then please comment on how I could have done better.