Script not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to achieve a remade version of the Roblox default backpack. So far I have only got the hotbar done.

  2. What is the issue?
    It isn’t working, but I am getting no errors what-so-ever. I even did a debugging on it using On Unhandled Expections.

  3. What solutions have you tried so far?
    Nothing helped me.

I just can’t figure out why it wont work.

The client script in a GUI:

local BackpackSystem = script.Parent
local Player = game.Players.LocalPlayer
local Hotbar = script.Parent.Hotbar
local Slot = script.Slot
local HoverText = script.HoverText
local Backpack = Player:WaitForChild("Backpack")
local Character = Player.Character
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local BackpackEquipToolRE = ReplicatedStorage:WaitForChild("BackpackEquipToolRE")
local Mouse = Player:GetMouse()
local Humanoid = Character:WaitForChild("Humanoid")
local Tools = Backpack:GetChildren()

local slotMax = 9

local numToWord = {
	[1] = "One",
	[2] = "Two",
	[3] = "Three",
	[4] = "Four",
	[5] = "Five",
	[6] = "Six",
	[7] = "Seven",
	[8] = "Eight",
	[9] = "Nine"
}

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

local function UpdateHotbar()
	
	for i, v in pairs(Hotbar:GetChildren()) do
		if v.Name == "Slot" then
			v:Destroy()
		end
	end
	
	
	
	for i, tool in pairs(Tools) do
		
		if i > slotMax then return end
		
		local newSlot = Slot:Clone()
		newSlot.Parent = Hotbar
		newSlot.Tool.Icon.Image = tool.TextureId
		newSlot.Tool.Number.Text = i
		
		newSlot.Tool.MouseEnter:Connect(function()
			newText = HoverText:Clone()
			newText.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
			newText.Text = tool.Name
			newText.Parent = BackpackSystem
			Mouse.Move:Connect(function()
				newText.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y)
			end)
		end)
		
		newSlot.Tool.MouseLeave:Connect(function()
			newText:Destroy()
		end)
		
		UserInputService.InputBegan:Connect(function(input, processed)
			local Equipped = newSlot:WaitForChild("Equipped", 5)
			if not processed then
				if input.KeyCode == Enum.KeyCode[numToWord[i]] then
					if Equipped == false then
						print(i..' was selected!')
						Equipped = true
						newSlot.Tool:TweenPosition(newSlot.Tool.Position + UDim2.new(0, 3, 0, 3), Enum.EasingDirection.In, Enum.EasingStyle.Back, .1, true)
						BackpackEquipToolRE:FireServer(Player, tool, tool.Parent)
					end
				end
			end
		end)
		
		newSlot.Tool.MouseButton1Click:Connect(function()
			local Equipped = newSlot:WaitForChild("Equipped", 5)
			if Equipped == false then
				print(i..' was selected!')
				Equipped = true
				newSlot.Tool:TweenPosition(newSlot.Tool.Position + UDim2.new(0, 3, 0, 3), Enum.EasingDirection.In, Enum.EasingStyle.Back, .1, true)
				BackpackEquipToolRE:FireServer(Player, tool, tool.Parent)
			end
		end)
	end
end

UpdateHotbar()

Backpack.ChildAdded:Connect(function(child)

	if not table.find(Tools, child) then
		table.insert(Tools, child)
		UpdateHotbar()
	end
end)

Backpack.ChildRemoved:Connect(function(child)

	if child.Parent ~= Character then
		table.remove(Tools, Tools[child])
		UpdateHotbar()
	end
end)

Character.ChildAdded:Connect(function(child)

	if child:IsA("Tool") and not table.find(Tools, child) then
		table.insert(Tools, child)
		UpdateHotbar()
	end
end)

Character.ChildRemoved:Connect(function(child)

	if child.Parent ~= Backpack then
		table.remove(Tools, Tools[child])
		UpdateHotbar()
	end
end)

BackpackEquipToolRE.OnClientEvent:Connect(function()
	for i, child in pairs(Hotbar:GetChildren()) do
		if child.Name == "Slot" then
			local Equipped = child:WaitForChild("Equipped", 5)
			if Equipped == true then
				Equipped = false
				child:TweenPosition(child.Tool.Position - UDim2.new(0, 3, 0, 3), Enum.EasingDirection.In, Enum.EasingStyle.Back, .1, true)
			end
		end
	end
end)

Why comment if you dont know then. Keep to yourself

What about it is not working? You need to be more specific.