I'm having an issue with AdjustSpeed()

Hi everyone! This is my first post on devforums!

I’m currently editing a public gun pack to try to personalise it. I’m trying to make it so when I reach a keyframe of a gun reload animation, the animation would pause by using AdjustSpeed(0). The person who made the gun pack had created a function for detecting keyframes and it works fine. I had tested this by putting a print statement inside the function.

The function plays fine when it reaches the keyframe, this was proven by my print statement, however, the animation speed does not adjust to 0/pause. I tried looking on other posts and many articles on the developer hub but cannot find a solution. How can I fix this? All help is appreciated!

PlayAnimation(Reload)
				Reload:AdjustSpeed(Reload.Length/MiscSettings.ReloadSpeed.Value) 
				CreateConnection(Reload, "HandleYourCartridge", function()
					print("handle")
					Reload:AdjustSpeed(0)
				end)

Here you can see the print statement working meaning the problem can’t be with the function.
Screenshot 2021-02-19 at 17.41.38

It can be if it has something to do with the animation. Make sure “Reload” isn’t referring to “Animation” but rather the “AnimationTrack”.

Screenshot 2021-02-19 at 17.45.44
It does refer to the track, so I don’t think it has to do with that exactly.

Well, upon looking more into adjust speed, try saving (Reload.Length/MiscSettings.ReloadSpeed.Value) into a variable, so that it prints the right number that you want. Once you have that variable, call it speed for example, put it into Reload:AdjustSpeed(speed)… but other than that I am pretty sure you’re able to stop the AnimationTrack with :Stop()

Sorry I am not much help, I never really had to use adjustspeed. Just some ideas!

It doesn’t seem like the value had fixed the problem. Instead of stopping the animation fully, I’m looking to pause it at that keyframe.

Thank you for the help either way!

It’s really weird how it’s not working… it should be pretty straight forward. Is “Handle” printing when you want it to or after the animation is over?

Yeah, ‘handle’ prints at the correct time when it reaches the keyframe

Update, I had messaged the original creator of the gun pack and he told me there was a script at the very bottom looping the AdjustSpeed to a value. I have since removed the code and the problem is now fixed!