At the first line it just say "Game script timeout" in output.
if not sound.IsPlaying then setSong() sound:Play() end
I hope one of you guys can help me. - Toby
This is because while
loops run very fast. In fact, all loops run at high speeds, and for that require a cooldown to prevent them from overloading the runtime. To solve your issue, write wait()
next to do
.
Here is the full script:
local sound = game.Workspace.Sound local songs = {2870416424, 1837466718, 1838103223} local Song = 1 sound.Looped = false while true do function setSong() local song = songs[Song] print(Song) Song = Song + 1 sound.SoundId = "rbxassetid://"..song print(Song) if Song == #songs then Song = 1 end end if not sound.IsPlaying then -- Stops at this line. setSong() sound:Play() end end