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
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
(There are more in it, for example the "setSong()" is a function in the script. It's just the first line it's stops at.)
Can you explain clearly please
Look down, I posted the full script.