Inventory not parenting items

Inventory items aren’t parenting to hotbar after being dragged.

I can’t show proof on a vid.

function module.MouseDown(currentMousePos, slotDragger, backpack, bag, hotbar, itemTemplate)
	if isDraggingItem == false and currentFrameBeingHoveredOn then
		if currentFrameBeingHoveredOn:IsDescendantOf(bag) == true then
			isDraggingItem = true
			--slotDragger.itemImage.Image = currentFrameBeingHoveredOn.itemImage.Image
			slotDragger.Visible = true
			currentFrameBeingHoveredOn.Visible = false

			for _, item in pairs(backpack:GetChildren()) do
				if item:IsA("Tool") then
					if item.Name == currentFrameBeingHoveredOn.Name then
						currentItemSelected = item
					end
				end
			end
			
			--if currentItemSelected then
			--	print("Dragging item:", currentItemSelected.Name)
			--	slotDragger.Main.Button.Text = currentItemSelected  -- Ensure Main and Button exist
			--else
			--	warn("Current item selected is nil.")
			--end

			print(currentFrameBeingHoveredOn.Name)

			while isDraggingItem == true do
				currentMousePos = UIS:GetMouseLocation()
				slotDragger.Position = UDim2.fromOffset(currentMousePos.X, currentMousePos.Y)
				--slotDragger.Main.Button.Text = currentSetName
				task.wait()
			end
			module.BagLoad(bag, backpack, itemTemplate)
		elseif currentFrameBeingHoveredOn:IsDescendantOf(hotbar) == true then
			for _, item in pairs(backpack:GetChildren()) do
				if item:IsA("Tool") then
					if item.slotIn.Value == slotsToNums[currentFrameBeingHoveredOn.Name] then
						currentItemSelected = item
						break
					else
						currentItemSelected = nil
					end
				end
			end
			
			slotDragger.Parent = currentFrameBeingHoveredOn

			if currentItemSelected then
				isDraggingItem = true
				--slotDragger.itemImage.Image = currentFrameBeingHoveredOn.itemImage.Image
				slotDragger.Visible = true
				
				--if currentItemSelected then
				--	print("Dragging item:", currentItemSelected.Name)
				--	slotDragger.Main.Button.Text = currentItemSelected  -- Ensure Main and Button exist
				--else
				--	warn("Current item selected is nil.")
				--end
				
				currentFrameBeingHoveredOn.Visible = false
				--currentFrameBeingHoveredOn.itemImage.Image = ""

				while isDraggingItem == true do
					currentMousePos = UIS:GetMouseLocation()
					slotDragger.Position = UDim2.fromOffset(currentMousePos.X, currentMousePos.Y)
					task.wait()
				end
			end
		end
	end
end

function module.MouseUp(slotDragger, hotbar, bag, backpack, itemTemplate)
	isDraggingItem = false

	if currentItemSelected and currentFrameBeingHoveredOn then
		if currentFrameBeingHoveredOn:IsDescendantOf(hotbar) == true then
			-- Check if the hovered slot is in the hotbar
			local slotName = currentFrameBeingHoveredOn.Name
			local slotIndex = slotsToNums[slotName]

			if slotIndex then
				-- Check if there's already an item in the slot
				local existingItem = nil
				for _, otherItem in pairs(backpack:GetChildren()) do
					if otherItem:IsA("Tool") and otherItem.slotIn.Value == slotIndex then
						existingItem = otherItem
						break
					end
				end

				-- Move current item to the slot
				if existingItem and currentItemSelected ~= existingItem then
					-- Swap items if the slot already has an item
					slotDragger.Main.Button.Text = existingItem.Name
					existingItem.slotIn.Value = currentItemSelected.slotIn.Value
				else
					-- Place the item in the empty slot
					slotDragger.Main.Button.Text = currentItemSelected.Name
					currentItemSelected.slotIn.Value = slotIndex
				end

				-- Parent the dragged item to the hotbar slot
				slotDragger.Parent = currentFrameBeingHoveredOn
			end
		elseif currentFrameBeingHoveredOn == bag then
			-- If dropped back into the bag, reset slotIn value
			currentItemSelected.slotIn.Value = 0
		end
	end

	-- Refresh UI
	module.BagLoad(bag, backpack, itemTemplate)
	module.HotbarLoad(hotbar, backpack)

	-- Hide the drag image
	slotDragger.Visible = false
	currentItemSelected = nil
end