Tool.Equipped giving errors

The output saying this all time
image

This is the script how can i fix it?

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.Camera
local RunService = game:GetService("RunService")



local ViewModel = game.ReplicatedStorage.ViewModel:Clone()


RunService.RenderStepped:Connect(function()




	if Player.Character.Humanoid.Health == 0 then
		if Camera:FindFirstChild("ViewModel")~=nil then
			Camera.ViewModel:Destroy()

		end
	end

	if Camera:FindFirstChild("ViewModel")~=nil  then
		Camera:WaitForChild("ViewModel"):SetPrimaryPartCFrame(Camera.CFrame * CFrame.new(0.1, -2.5, -1) * CFrame.Angles(0.05, 0,0))
	end



	Character:FindFirstChild("KitsuneKatanaFE").Equipped:Connect(function()

		ViewModel.Parent = Camera
		
		

		Character:FindFirstChild("KitsuneKatanaFE").Unequipped:Connect(function()
			ViewModel.Parent = Player
	
		end)
		
		if (Camera.CFrame.p - Camera.Focus.p).Magnitude < 0.6 then 

			for _, child in pairs(ViewModel:GetDescendants()) do
				if child:IsA("BasePart") or child:IsA("MeshPart") then
					child.Transparency = 0



				end
			end

		else
			for _, child in pairs(ViewModel:GetDescendants()) do
				if child:IsA("BasePart") or child:IsA("MeshPart") then
					child.Transparency = 1

				end


			end

		end
		
		
		if (Camera.CFrame.p - Camera.Focus.p).Magnitude < 0.6 then 

			for _, child in pairs(Character:FindFirstChild("KitsuneKatanaFE"):GetDescendants()) do
				if child:IsA("BasePart") or child:IsA("MeshPart") then
					child.Transparency = 1



				end
			end

		else
			for _, child in pairs(Character:FindFirstChild("KitsuneKatanaFE"):GetDescendants()) do
				if child:IsA("BasePart") or child:IsA("MeshPart") then
					child.Transparency = 0

				end


			end

		end
		

	end)

end)

.

The problem is the thing you are using Equipped event on is not a tool!
Try to use print(Object.Name) to see what you are exactly using Equipped event on.

1 Like

image
Working.

Actually, the thing he is using Equipped on doesn’t exist at all. One of the FindFirstChilds isn’t finding anything