Sound.Ended:Wait only works sometimes yet Sound.Ended:Connect works everytime

really tired writing this but i’m trying to make a sound play with random speed and random volume, and i need to do an event after the sound ends.

so i tried doing sound.ended:wait, then when i playtested i noticed it only works sometimes when i’m tabbed off of roblox studio, weirdly enough.

then i tried sound.ended:connect, and then it works every time whether or not i’m tabbed off.


some explanation would be greatly appreciated

Head.sfx.Ended:Wait() will only run once, and that’s when the sound ends for the first time after this is called. I’m assuming you wanted this:


ah alright, that does not explain the tabbed off part though, but thanks

I’m assuming it has something to do with the sound having already been ended and it counted there. I’m not sure why exactly it would only run while you’re tabbed out as it works perfectly fine for me.