Limited Number of Items in Inv

Hello, so I have a button players can press to give them a football. But the issue is that they can spam and have like a million of them. The button works fine, just is there any way I can limit a players inv to having 1 football. A way where if a player has a football, the button recognizes it and does not let them have another.

Here is what I have:

image
image

You can check if the player already has a football inside their backpack or character.
If the player is having a tool in their hand it appears in game.Players.LocalPlayer.Character. Otherwise if unequipped it’s inside game.Players.LocalPlayer.Backpack.

function localPlayerHasTool(name: string): bool
    if player.Character then
        if player.Character:FindFirstChild(name) then return true end
    end
    
    return player.Backpack:FindFirstChild(name) ~= nil
end
...
if not localPlayerHasTool("Football") then
    give:FireServer()
end

Would this allow only 1 football in the players inventory?

Nope, whoops forgot a not in the if statement. I’ve fixed it now

if not localPlayerHasTool(“Football”) then
give:FireServer()
end

In the code you posted above, you are checking if the player has the football. This means that the give event will only occur when the player doesn’t have the football. So, if they don’t have the football they can press the button and get it. If they do have the football, they cannot press the button.

image

Can I see your full script? You may have made some typos.