I'm working on a shooter game that requires the player to reload after they use up all their bullets in a clip. Each gun takes different length of times to reload, so I need to change the animation length to fit the reload time. I've currently tried the AdjustSpeed() method to change the speed to play at 75% of it's original speed (which, I've tested, prints out 0.75 as its speed), but when the animation track is played using :Play(), the animation does not appear to be slowing down.
Here is the function for reloading:
function reload() reloading = true reloadAnim:AdjustSpeed(reloadAnim.Length/reloadTime.Value) -- Anim speed does change, but it doesn't appear to slow down when played?? print(reloadAnim.Speed) -- Prints out 0.75 reloadAnim:Play() -- Animation finishes playing a noticeable amount quicker than the wait() time, despite having its speed changed to 0.75 wait(reloadTime.Value) clips.Value = clips.Value - 1 -- Clip and ammo values changes a while after the animation has finished playing ammo.Value = maxAmmo.Value reloading = false end
reloadAnim is an already-loaded AnimationTrack that has an original length of 1.5 seconds, and the reloadTime.Value is 2. The reload function is called with reload() once when the player presses the "R" key.
If there is not enough context to solve this issue, please let me know.
function reload() reloading = true print(reloadAnim.Speed) -- Prints out 0.75 reloadAnim:Play() -- Animation finishes playing a noticeable amount quicker than the wait() time, despite having its speed changed to 0.75 reloadAnim:AdjustSpeed(reloadAnim.Length/reloadTime.Value) -- Anim speed does change, but it doesn't appear to slow down when played?? wait(reloadTime.Value) clips.Value = clips.Value - 1 -- Clip and ammo values changes a while after the animation has finished playing ammo.Value = maxAmmo.Value reloading = false end