Jump Animation Delay

Hello! I made a script that replaces the Animation ID from the default animation ID on the Default Animation script by Roblox but when I jump it only plays the animation sometimes and not always. The Animation I made for jumping is 0.3 seconds long. Any help would be amazing :smiley:

This script segment is the default animation script by Roblox
image

image

This is a script I made to replace change the animation ID once a player touches a part