When I play a Sound, then decide to :Clone() it and attempt to play the clone, I hear playback start then strangely cut off. Then if more clones are played audible playback ceases until one or two more cycles. Interestingly, this only occurs if you play the original Sound prior to starting the clone playback cycle—the clones don’t interrupt each other in this manner.
Here’s a video of the bug happening:
Watch what happens when I comment out line 27(No Original Sound)
Hey @700000002, since commenting out that line does not encounter the same issue, I think what might be happening is that the clone grabs its initial TimePosition property from whatever testsound currently has – that is, if testsound is actively playing, its TimePosition is actively advancing, so cloning it might create a clone that has a nonzero, positive start-time.
Sort of, Play is a sort of ‘magic function’ (not an official name, just came up with the term myself about 10 seconds ago ) in-where it sets the TimePosition to the last TimePosition value set by a lua script; or zero, if none is found. This is listed in the documentation, unsure if it applies to cloning as well, though.
Yeah, I went straight to the docs when I encountered the issue.
Since I never set the TimePosition in the script, I expected the TimePosition to be 0 when using Play(). The clone Play() behavior doesn’t feel intuitive to me; it feels like a bug rather than a feature.
Yeah I can see how this is unintuitive; since Cloning sets all the properties on the new instance, this counts as the “last set TimePosition” – being able to tell the difference between a script setting TimePosition directly and setting it via :Clone would probably require us adding more machinery – and there’s a chance that it breaks somebody’s workflow since the behavior has been like this for a while
The complex behavior of Play/Stop/Pause/Resume is one of the big reasons we made AudioPlayer only have Play/Stop, and neither of them have side effects that modify TimePosition