Fixing Tuck Help!

I scripted a keybind script for tuck and I’m trying to make it so If the player doesn’t have the football in there inventory then the animation will stop. Please help. This is the script:

local Player = game.Players.LocalPlayer
local Football = workspace:FindFirstChild(“Football”)
local Tool = script.Parent.Parent
local character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = character:FindFirstChild(“Humanoid”)
wait()
local KeyPressed = Enum.KeyCode.Q
local animationId = “6289890229”
local userInputService = game:GetService(“UserInputService”)
local animationtrack = character.Humanoid:LoadAnimation(script.Tuck)

userInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == KeyPressed then
if not animationtrack.IsPlaying then
animationtrack:Play()
else
animationtrack:Stop()
end
end
end)

1 Like

Add this:

local Player = game:GetService("Players").LocalPlayer
Backpack = Player:WaitForChild("Backpack")
local OtherCondition = true
Backpack.ChildAdded:Connect(function(Tool)
    if Tool.Name == "Football" and OtherCondition then
        animationtrack:Stop()
    end
end)
Backpack.ChildRemoved:Connect(function(Tool)
    if Tool.Name == "Football" and OtherCondition then
        animationtrack:Play()
    end
end)

If you don’t need another condition to work, remove “and OtherCondition”.

Do it put it under end) Or do I put it before the end)

In the end.
This will see whether or not the player has the item in hand.
PS: I fixed it, it was backwards lol.

Im sorry but im am very confused but ill try.