Song wont loop and I don't know why

So I was making a radio and the music wouldn’t loop even though i put Sound.Loop = True

Heres the code:

local ContentProvider=game:GetService(“ContentProvider”);
local Music=script;
local Sound=Music.Parent;
local Audio=Sound:FindFirstChild(“Music”);
if Audio.IsPlaying == true then
Sound.Looped = true
Audio:Stop()
end
Audio:Play()

is Playing property true or false? (while editing in studio)

1 Like

Yeah, I think so but it still play the audio, when the music ends it just stops playing. I want it to loop the song infinitely

can you add print("Playing!") above the Sound.Looped = true and tell me if it prints?

1 Like

Alright lemme do that real quick

Ok so it printed, so what now?

why are you stopping sound if it’s playing?

1 Like

Wait what do you mean by that??

you’re stopping the sound here. Isn’t it pointless? you don’t need to stop the sound. So you don’t need Sound:Play() too because it’s already playing the sound when you join.

1 Like

By what you provided in the script you’re only checking once if the audio is playing. Also you’re stopping the audio as soon as it plays.

Something like this should work.

local Audio = script.Parent:FindFirstChild("Music")
Audio:Play()
Audio.Looped = true
1 Like

Oh I see now, I don’t know why I wrote that. Should i remove it?

yes and why don’t you just set Looped property to true manually?

1 Like

Ok I tried this and it worked, it started to loop

Thank you everyone for the help!

2 Likes