Function not working

Hello, so this is my code, but it’s not working, when I run updateBack() function, is not working or giving error, which is really weird…
This is how GUI looks
image

Character.ChildAdded:Connect(function(ChildAdded)
			if ChildAdded:IsA("Tool") then
			for i,v in ipairs(script.Parent.Backpack:GetChildren()) do
				if v:IsA("GuiObject") then
					if v.ToolName.Text == ChildAdded.Name then
						v.Effect.ImageTransparency = 0
					end
				end
			end
			end
		end)
		
				Character.ChildRemoved:Connect(function(ChildAdded)
			if ChildAdded:IsA("Tool") then
			for i,v in ipairs(script.Parent.Backpack:GetChildren()) do
				if v:IsA("GuiObject") then
					if v.ToolName.Text == ChildAdded.Name then
						v.Effect.ImageTransparency = 0.5
					end
				end
			end
			end
		end)
		
		
			
	
	 function updateBack()
		print('Child')
			for i,v in ipairs(Player:FindFirstChild('Backpack'):GetChildren()) do

		
				if v:IsA("Tool") then
					
						if v:FindFirstChild("Class").Value == "Primary" then
							local frame = script.Parent.Backpack.Primary
							frame.Visible = true
							print('True')
							frame.ToolName.Text = v.Name
							elseif v.Class.Value == "Secondary" then
							local frame = script.Parent.Backpack.Secondary
							frame.Visible = true
							frame.ToolName.Text = v.Name
							--[[elseif v.Class.Value == "Third" then
						local frame = script.Parent.Backpack.Secondary
							frame.Visible = true
							frame.ToolName.Text = v.Name]]
						end
					
				end
			
			end
		end
	
		
		Player.Backpack.ChildAdded:Connect(function()
			updateBack()
		end)
		Player.Backpack.ChildRemoved:Connect(function()
			updateBack()
		end)
		
		local function UnequipTool()
			if Character:FindFirstChildWhichIsA("Tool") then
				Character:WaitForChild("Humanoid"):UnequipTools()
			end
		end
		
		local function EquipTool(Name)
		if Character:FindFirstChildWhichIsA("Tool") then
			local Hey = Character:FindFirstChildWhichIsA("Tool") 
			if Hey.Name == Name then
				UnequipTool()
		elseif Hey.Name ~= Name then
		Character:WaitForChild("Humanoid"):EquipTool(Player.Backpack:FindFirstChild(Name))
		return
			end
		end
			if not Character:FindFirstChildWhichIsA("Tool") then
				if Player.Backpack:FindFirstChild(Name) then
					Character:WaitForChild("Humanoid"):EquipTool(Player.Backpack:FindFirstChild(Name))
				end
			end
		end
		
		for i,v in ipairs(script.Parent.Backpack:GetChildren()) do
		  if v:IsA("GuiObject")	then
			v.ToolName.MouseButton1Click:Connect(function()
						if  not Character:FindFirstChild(script.Parent.Backpack[v.Type.Value].ToolName.Text) then
					EquipTool(script.Parent.Backpack[v.Type.Value].ToolName.Text)
			else
						UnequipTool()
					end
				end)
		end
		end
		
		UIS.InputBegan:Connect(function(input, gamepro)
			if UIS:GetFocusedTextBox() == nil then
				if script.Parent.Backpack.Visible == true then
				for i,v in ipairs(script.Parent.Backpack:GetChildren()) do
					if v:IsA("GuiObject") then
						if input.KeyCode == Enum.KeyCode[v.KeyCode.Value] then 
								if  not Character:FindFirstChild(script.Parent.Backpack[v.Type.Value].ToolName.Text) then
					EquipTool(script.Parent.Backpack[v.Type.Value].ToolName.Text)
			else
						UnequipTool()
					end
				end
					end
				end

			end
			end
		end)

It’s not printing “Child”

** I know I made a post about this, I had to remade it **
This are tools: image

Mandatory questions here:

  • What type of script is it? Script (runs on the server) or LocalScript (runs on the player’s computer)

  • Where is the script located?