Custom Inventory System

I want missing hotbars to popup, if there are any empty slots, when the player opens up their backpack. I have to semi-working but I don’t know how to delete the templates after the inventory is closed again, or maybe even a better method to create the templates and remove them.

Black Leaf - Roblox Studio (gyazo.com)

	if input.KeyCode == Enum.KeyCode.Backquote then
		inventory.Visible = not inventory.Visible
		local SlotsNeeded = 9 - Slot
			for i= Slot, SlotsNeeded do
				local faketem = script.Template:Clone()
				faketem.Parent = script.Parent.Container
				faketem.NumberIndex.Text = i+1
				faketem.toolName.Text = ""
		end
	end

You are creating them. You just need to delete them.