ok so this script is in a npc so when they eat it they get the XP but it eats everything listed as a "Tool" and i want it to eat a specific tool not all the tools....EX: it eats swords and guns and all i want it to eat is the Fruit.
local thename = game.Players:findFirstChild(script.Parent.Owner.Value).PlayerGui.GuiProject1
d = script.Parent:Clone()
debounce = false
function t(h)
if debounce == false then
debounce = true
if h.Name == "Handle" then
if h.Parent.className == "Tool" then
h.Parent:Remove()
thename.AnimalHunger.Value = 0
thename.AnimalXP.Value = thename.AnimalXP.Value + 3
script.Parent.NOM:Play()
end
end
debounce = false
end
end
script.Parent.Torso.Touched:connect(t)

2 comments
I don't get it, how does it work? What is that? it doesn't even look like you changed anything...
I forgot to comment on it. I changed line 9 if you check. I made it so it looks for a tool then checks the tools name. You can add other names also. This way it only deletes what you're wanting to remove