Hi I made a client event but I see no option to stop a :playlocalsound and sound:Play() doesn’t work in a client event. How to fix this? thanks for reading/helping
local function play()
print("play")
game:GetService("SoundService"):PlayLocalSound(script.Sound)
game.ReplicatedStorage.RemoteEvent:FireServer()
script.Sound:Stop() --doesn't work
end
game.ReplicatedStorage.RemoteEvent2.OnClientEvent:Connect(play)
Sound:Play should work on the client, it’s possible you can’t hear it because of the sound’s parent or volume. Usually I put sounds that don’t need to be played in the 3D world in a ScreenGui. If you need a sound to be played in the world you could parent the sound to a part.
SoundService:PlayLocalSound is usually used for short sounds that need to be played on the fly and therefore aren’t stoppable. I noticed this when trying to implement sound effects, thought it was a bug but turns out it isn’t. :PlayLocalSound is something completely isolated from the sound instance. It sort of like makes an anonymous inaccessible copy of the sound, plays it, then gets rid of it.
You should just play your sound in a client desired service such as starter gui or replicated storage. I have never had a time where I needed to use sound service.
So when the sound is in the StarterGui or the ReplicatedStorage the sound will be local? actually sounds quite logical because the PlayerGui, for example, is literally in the player. I’ll try it out.