How do i prevent the player from getting the same tool multiple times?

I’m trying to make a tool giver that denies if you already have the tool, but for some reason when you have the tool equipped it still gives you it anyway.

I tried looking for a solution when the game is running to see where the tool goes if you have it equipped, and it goes into the player’s model. But, when i tried making it check for when the tool is inside the player, it still didn’t work. Anyone have any ideas?

Code:

local Toolname = ("Goala Cola") -- checks for the name of the tool
local Storage = game:GetService("ServerStorage")
local Tool = Storage:FindFirstChild(Toolname) -- checks for the actual tool

local Part = script.Parent
local ProximityPrompt = script.parent.ProximityPrompt

ProximityPrompt.Triggered:Connect(function(Player)
	if Player and Player.Character then	
		local Backpack = Player:WaitForChild("Backpack")
		local Character = Player.Character
		if not Backpack:FindFirstChild(Toolname) or not Character:FindFirstChild(Toolname)
				script.Parent.bass:Play() -- for extra sauce
				Tool:clone().Parent = Backpack -- gives you the tool
		elseif Backpack:FindFirstChild(Toolname) then
			Part.deny:Play()  -- indicates you already have the tool
			  end -- does nothing
		end
end)
1 Like

Here you are checking if EITHER their backpack or character lacks the tool, you are also missing a then

1 Like

Damn, it worked. all i had to do was replace “Or not” with “And not”
thank you my dude

P.S
if not Backpack:FindFirstChild(Toolname) and not Character:FindFirstChild(Toolname) then
is equivilent to:
if not (Backpack:FindFirstChild(Toolname) and Character:FindFirstChild(Toolname)) then

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.