I'm making a game, and the gun I've made works fine, however, the reload animation is the only thing that doesn't work. Does anybody know how I can fix this?

Here is the script to play the reload animation, there are variables for the reloadTrack and reloadAnim, and in the handle of the gun, there's a sound named 'Reload':

tool.reload_sound:Connect(function()
	if reload_sound:Playing() then
		reloadtrack = script.Parent.Parent.Humanoid:LoadAnimation(reloadAnim)
	reloadtrack.Priority = Enum.AnimationPriority.Action
		reloadtrack.Looped = false
		reloadtrack:Play()
	else
		return
	end
end)
tool.Unequipped:Connect(function()
	if track then
		track:Stop()
	end
end)

5 comments

0

Try some tests with prints and see where the function stops and maybe make adjustments or give us further animation

0

It stopped just after the first line.

0

Any errors?

0

There aren't any errors, which really confuses me. I have updated my script in the game, too:

0

I have just updated the post's script, so you can see it.