How to make a sprint script that would stop animating whenever I jump?

Alright, I know what you’re going to say:
“Check the .Jump value!”
“Use user Input and check when the player presses space!”
combination of the two above!”

I have tried all of these and none of them work properly (.Jump lags when you jump too fast and doesn’t work right when you hold down space, user input doesn’t sync with the actual jump action and both of these combined make a big mess). That’s why I came to ask: How in the world do you make a sprinting script that animates until you jump, then stops, then starts animating again?

Please note that I have a sprint script done already. I’m just missing the jump function, and I have no idea how to make it function properly.

You could create a script where it measures your position. X,Y,Z. In this case we’d be measuring Y. Since thats what changes when a player jumps. If Y Is increased by a specific number (The Ammount Y is increased when Jumped) then the animation stops and when it decreases by that number again the animation replays.

Edit: It needs to be specific because if you fall of a block or something it could replicate the effect

You could create a while loop script and fire a ray in it downwards from your torso and check if it hits a part

This will be quite limited without extensive additions to the script, but to start off I would use Instance:GetPropertyChangedSignal to detect if the Y value of your character’s Vector3 has changed as so:
local char = game.Players.LocalPlayer:WaitForChild(“Character”)
local Torso = char:WaitForChild(“Torso”)
and then from there check if the Torso’s Y axis has moved. If so, stop the animation until the torso’s Y axis is equal to either the floor, or the Torso’s Y axis prior to the jump.