Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i Detect cloned tools in backpack with a script?

local ToolName = "FireBall"

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if Player.Backpack:FindFirstChild(ToolName) then
			print("Player has tool in backpack!")
		else
			print("Player does not have tool in backpack!")
		end
	end)

end)

this just detect if i have the tool or not but not if it has a duped it happens for me somehow

1 answer

you would add a not statement to check if the player already has the item or not you can do this like this

local ToolName = "FireBall"

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        if Player.Backpack:FindFirstChild(ToolName) and not player.StarterGear:FindFIrstChild(ToolName) then
            print("Player has tool in backpack!")
        else
            print("Player does not have tool in backpack!")
        end
    end)

end)

here the 'and not player.StarterGear:FindFirstChild(toolname)' will check if the tool is already in backpack or not

This discussion is preserved as it was. New answers, comments, and votes are closed.