I tried this but it says that Gather1 is not a valid member of backpack, so it breaks. I'm trying to make it so that you can't buy the item if you already have it. I also need this for when they want to sell something.
function onClick(hit)
if game.Players.LocalPlayer.leaderstats.Gold.Value >= 5 and game.Players.LocalPlayer.Backpack.Gather1 == nil then
game.Players.LocalPlayer.leaderstats.Gold.Value = game.Players.LocalPlayer.leaderstats.Gold.Value - 5
tool = game.ReplicatedStorage.Tools.Gather1:Clone()
tool.Parent = game.Players.LocalPlayer.Backpack
end
end
script.Parent.MouseButton1Down:connect(onClick)

2 comments
Use more variables.
When I attempt to buy it, I get the same message that it isn't in my backpack. And if I have a copy in my backpack, it doesn't have any errors, but it will give me another tool.