When running :Play()
on a sound on the client, the Played
event does not trigger without a delay such as task.wait()
if the sound has been replicated, despite the sound instance producing audio.
I am able to reproduce this 100% of the time in Studio and games joined from the website.
Repro
Steps:
- Create a sound on the server
- Listen for its creation on the client and then…
- Connect to
Played
on the client - Play the sound from the client
Example LocalScript and Script, respectively:
local CollectionService = game:GetService("CollectionService")
CollectionService:GetInstanceAddedSignal("Sound"):Connect(function(sound: Sound)
sound.Played:Connect(function()
warn("This will not fire without a workaround.")
end)
sound:Play()
end)
local sound = Instance.new("Sound")
CollectionService:AddTag(sound, "Sound")
sound.SoundId = "rbxassetid://9112758242"
sound.Parent = workspace
Place File:
Repro.rbxl (39.8 KB)
Expected Result
The Played
event fires when the sound is played.
Actual Result
The Played
event does not fire, despite the sound producing audio.
Here is a video showing how the Played
event never fires, using the repro file: