How to get tool that have changed name?

the name wouldn’t work because the tool’s name is going to change

It would work since string.match detects the word in the name. An example would be:

name = "Wood [64]"
print(string.match(name, "Wood")) -- this will print 'Wood' since 'Wood' exists in the name
print(string.match(name, "Stone")) -- this will print 'nil' since 'Stone' doesnt exist in the name

name = "Wood [42]"
print(string.match(name, "Wood")) -- this will still print 'Wood' since 'Wood' exists in the name

hmm it seemed to have given me two when i broke one of the table at the start…and it didn’t clone me a tool when i have no tool in my inv, it did give me the leaderstat point though.

wait()
local Stone = script.Parent.Value.Value
a = true
hasTool = false
script.Parent.At.Break.Triggered:Connect(function(plr)
	

	if Stone ~= 0 then
		if a then
			a = false
			Stone = Stone - 1
			
			script.Parent.Parent.Thing.Transparency = script.Parent.Parent.Thing.Transparency + 0.25
			script.Parent.Parent.Thing2.Transparency = script.Parent.Parent.Thing2.Transparency + 0.25
			script.Parent.Parent.Thing3.Transparency = script.Parent.Parent.Thing3.Transparency + 0.25
			script.Parent.Parent.Thing4.Transparency = script.Parent.Parent.Thing4.Transparency + 0.25
			script.Parent.Parent.Thing5.Transparency = script.Parent.Parent.Thing5.Transparency + 0.25
			wait(1)
			a = true
		end
	end

	if Stone == 0 then
		
		for i, v in pairs(plr.Backpack:GetChildren()) do
			if string.match(v.Name, "Wood") and v:IsA("Tool") then
				hasTool = true-- new here
				plr.Resources.Table.Value = plr.Resources.Table.Value + 1
				script.Parent.At.Break:Destroy()
				script.Parent.At.Table:Destroy()
				script.Parent.Parent:Destroy()
			end
		end

		-- For player's character
		if plr.Character then
			for i, v in pairs(plr.Character:GetChildren()) do
				if string.match(v.Name, "Wood") and v:IsA("Tool") then
					hasTool = true-- new here
					plr.Resources.Table.Value = plr.Resources.Table.Value + 1
					script.Parent.At.Break:Destroy()
					script.Parent.At.Table:Destroy()
					script.Parent.Parent:Destroy()
					-- the player has the Wood tool
				end
			end
		end
		for _, obj in pairs(plr.Character:GetChildren()) do
			if obj:IsA("Tool") and obj.Value.Value == "Table" then
				hasTool = true-- new here
				plr.Resources.Table.Value = plr.Resources.Table.Value + 1
				script.Parent.At.Break:Destroy()
				script.Parent.At.Table:Destroy()
				script.Parent.Parent:Destroy()

				break -- stop the loop once found
			end
		end
		
		if hasTool == false then
			local clone = game.ReplicatedStorage:WaitForChild("Crafting table"):Clone()
			clone.Parent = plr.Backpack
			plr.Resources.Table.Value = plr.Resources.Table.Value + 1
			script.Parent.At.Break:Destroy()
			script.Parent.At.Table:Destroy()
			script.Parent.Parent:Destroy()
		end
			
	end
end)