I have this script that gives me 1 sand if a humanoid touches it. I want to change it so it gives you 1 sand when a tool touches it. Does anybody know how to change it?
script.Parent.Touched:connect(function(part) if game.Players:findFirstChild(part.Parent.Name) then local plr = game.Players:findFirstChild(part.Parent.Name) plr.leaderstats.Ice.Value = plr.leaderstats.Ice.Value + 1 end end) local debounce = true script.Parent.Touched:connect(function(part) if debounce then debounce = false if game.Players:findFirstChild(part.Parent.Name) then local plr = game.Players:findFirstChild(part.Parent.Name) plr.leaderstats.Ice.Value = plr.leaderstats.Ice.Value +1 script.Parent:destroy() end end end)
thanks
script.Parent.Touched:connect(function(part) if part.Parent:IsA("Tool") and game.Players:FindFirstChild(part.Parent.Parent.Name) then local plr = game.Players:findFirstChild(part.Parent.Parent.Name) plr.leaderstats.Ice.Value = plr.leaderstats.Ice.Value + 1 end end)
Something like this, I guess