ProximityPrompt Tool Giver not working

My goal is to have a player pick up a tool with ProximityPrompt and I don’t want any duplicates of the same tool in the players backpack. (I’m not too good at scripting)

I realized there was a flaw. When I went to pick up the item again, this time with the item in my hand, it picks up another Pepperoni Pizza. I want the player to just have one of that specific item. Two Pizzas

I have tried looking all over for some help but can’t seem to find any.

Here is the script for the prompt, Mesh>ProximityPrompt>Script

script.Parent.Triggered:Connect(function(Player)
	if Player.Backpack:FindFirstChild("Pizza") then
		return
	end
	local Pizza = game.ReplicatedStorage.Pizza:Clone()
	Pizza.Parent = Player.Backpack 
end)

If you have any questions please let me know.

This is because when a tool is equipped it goes to the player’s character, simply add a :FindFirstChild() to search for the tool inside it.

script.Parent.Triggered:Connect(function(Player)
	if Player.Backpack:FindFirstChild("Pizza") or Player.Character:FindFirstChild("Pizza") then return end

	local Pizza = game.ReplicatedStorage.Pizza:Clone()
	Pizza.Parent = Player.Backpack 
end)
4 Likes

Thank you, you’re a life saver!

1 Like