Well, I have a problem with the FindFirstChild and the error occurs when I unset a defined tool. Basically the following script, when playing a part detects with a loop objects defined in the player’s character, in part it works fine at first but if you un-equip the tool by continuing to play the part, it gives me the error of the title.
local Players = game:GetService("Players")
local function Lumber(hit)
local Owner = script.Parent.Parent:FindFirstChild("Owner")
if Owner.Value == "N/A" then
local character = hit:FindFirstAncestorOfClass("Model")
local Player = Players:GetPlayerFromCharacter(character)
if not Player then
return
end
Owner.Value = Player.Name
end
if Enabled == false then
while Enabled == false and wait(0.02) do
local character = hit:FindFirstAncestorOfClass("Model")
local Player = Players:GetPlayerFromCharacter(character)
local HachaDeMetal = character:FindFirstChild("Hacha de metal")--Here are the tools.
local HachaDePiedra = character:FindFirstChild("Hacha de piedra")
local SistemTreeFolder = character:FindFirstChild("SistemaDeTala")
local HachaDeCuarzo = character:FindFirstChild("Hacha de cuarzo")
local HachaDeObsidiana = character:FindFirstChild("Hacha de obsidiana")--[[This is where the tool ends. Basically, the loop is activated every 0.02 seconds, the loop detects the tools
but when unequipping them from the character, it starts giving the error. The error does not occur when playing the part with the tool already set or equipping it after
playing the part but rather when you unequip it by playing the part.]]--
end
end
end