local Sound2 = Instance.new("Sound", Character)
Sound2.SoundId = "rbxassetid://4825612647"
Sound2.Volume = 1
Sound2.Looped = true
Sound2:Play()
while wait() do
game:GetService("SoundService"):PlayLocalSound(Sound2) -- I realized this was clientside, and now I'm in a hole where I don't know what to do.
end
✓ ANSWER ACCEPTED
How do I play music with a loop on, without it interrupting on serverside?
1 answer
✓ Accepted answer
You're actually playing the sound twice.
local Sound2 = Instance.new("Sound", Character)
Sound2.SoundId = "rbxassetid://4825612647"
Sound2.Volume = 1
Sound2.Looped = true
Sound2:Play() -- here...
while wait() do
game:GetService("SoundService"):PlayLocalSound(Sound2) -- ...and right here
end
The server plays the sound to all clients (I'm assuming it does, but if it doesn't then you should parent the Sound to anything the client can access, like ReplicatedStorage) and you're playing it locally...again. If you're trying to play it on one client, why not try playing the sound from a LocalScript?
I also would not suggest looping the sound, because that's likely the reason it's interrupting itself. Every time the loop iterates, it plays the sound from the beginning over and over again. At best, play the sound and wait for it to finish in a loop:
while true do
Sound2:Play()
-- There are two different ways you can do this. One is by directly polling for the sound to finish by using another loop. The other is to use the script signal. (Both of them poll for it anyway.) I will demonstrate both of these options.
-- Option 1
repeat wait() until not Sound2.IsPlaying
-- Option 2
Sound2.Ended:Wait()
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Do you just want to do it localy to players?