I have a script that gives you 1 coin when a humanoid touches it. I want to change that script to where if a tool touches it it gives me one coin. Script
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Touched:Connect(function(hit)
if not script.Parent:FindFirstChild(tonumber(v.Name)-1) then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and plr:FindFirstChild("leaderstats") then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 1
end
v:Destroy()
end
end)
end
end
