Once again i am trying to make a gear, but when you press "X" you do an ability, and for some reason the animation is not playing (Its on a LocalScript too)

local player = game.Players.LocalPlayer
local character = script.Parent.Parent
local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local db = true
local anim = script:WaitForChild("Snap")



local function onInputBegan(input, gameProcessed)
	if input.UserInputType == Enum.KeyCode.X then
		if db == true then 
			local animationTrack = character.Humanoid.Animator:LoadAnimation(script.Snap)
			animationTrack:Play()
			wait(1)
			script.Parent.onSnapped:FireServer()
			db = false
			wait(30)
			db = true
		end
	end
end

UserInputService.InputBegan:Connect(onInputBegan)