From 89530141f7e7f0cc08867d39d0f954f1d78d8092 Mon Sep 17 00:00:00 2001 From: Ryan <80087248+RyanLua@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:40:55 -0700 Subject: [PATCH] Fix playback --- src/Shime.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Shime.lua b/src/Shime.lua index 254fd1f..86b27f5 100644 --- a/src/Shime.lua +++ b/src/Shime.lua @@ -115,7 +115,8 @@ end -- Setup tween completion callback function Shime:_TweenCompleted() - self:Stop() + self._frame.Visible = false + self.PlaybackState = Enum.PlaybackState.Completed end -- Get the shimmer frame @@ -135,26 +136,25 @@ end -- Start shimmering function Shime:Play() - self.PlaybackState = self._tween.PlaybackState + self.PlaybackState = Enum.PlaybackState.Begin + self._frame.Visible = true self._tween:Play() - self.PlaybackState = self._tween.PlaybackState + self.PlaybackState = Enum.PlaybackState.Playing end -- Pause shimmering function Shime:Pause() - if not self.IsCompleted then - self._frame.Visible = true - self.PlaybackState = self._tween.PlaybackState + if self.PlaybackState == Enum.PlaybackState.Playing then self._tween:Pause() - self.PlaybackState = self._tween.PlaybackState + self.PlaybackState = Enum.PlaybackState.Paused end end --- Stop shimmering -function Shime:Stop() - self.PlaybackState = self._tween.PlaybackState +-- Cancel shimmering +function Shime:Cancel() self._tween:Cancel() self._frame.Visible = false + self.PlaybackState = Enum.PlaybackState.Cancelled end return Shime