Tool not deleting itself

i have a script that handles the tool being deleted after a leaderstat is 0, however it isn’t doing that, it is a local script in a tool

local value = game.Players.LocalPlayer.Resources.Wood.Value
local newvalue = game.Players.LocalPlayer.Resources.Wood
	if newvalue.Value == 0 then
	script.Parent.Name = ("Wood ["..player.Resources.Wood.Value.."]")

it changes the tool name but it dosn’t delete it self, leaving me with a tool that is named wood [0]

Your code works fine and deletes the tool on my end. As a side note: when the changed event runs, if the value is zero, you’re changing the name of the tool after destroying it - which will error. You cannot change the properties of an object that is nil.

Is newvalue an IntValue instance? Because if it’s a StringValue instance then this won’t work as you’d essentially be comparing the following.

if "0" == 0 then --Never true.
	--Do code.

If that is the case then I suggest you either switch the StringValue into an IntValue or you use the following code to convert the string value into a number value.

if tonumber(newvalue.Value) == 0 then