Problem: The script does not work once a player clicks on the brick with and without a certain tool in their backpack.
Goal: I want to make is to if a player clicks on a certain part, the script will detect a tool in their backpack. If the certain tool is inside their backpack or if they are holding it, it will be removed and they will earn 5 coins.
TakeToolScript
local find = Character:FindFirstChild("TestTool") or Player.Backpack:FindFirstChild("TestTool")
local coin = game.Players.LocalPlayer.Currency.Coins
function onClick(PersonWhoClicked)
if find then
find:Destroy()
coin.Value = coin.Value + 5
else
print("Error finding tools")
end
script.Parent.ClickDetector.MouseClick:Connect(onClick)
Can anyone please help me understand why the script is not working whenever a player clicks the brick. Neither does it print "Error finding tools" nor destroys the TestTool and give Coins.

1 comment
No he is correctly using "if find then"