GUI Doesn't update/render?

I am making a script which will recieve an event for when the inventory gets updated, and adds items to the inventory gui.

When the inventory updates, the client recieves everything and the items are inside the inventory frame in the explorer, however, it doesnt actually render on the screen until I click the inventory frame in the explorer. It’s really weird.

GIF: https://gyazo.com/c8b25508aee6750099cde8c682e165b5?token=4d165a8e5fa01d40c267b9b42c55909c

Anyone got any ideas on what might be the issue?

Still looking for help with this

while true do
wait(1)
--// update script.
end

That’s not the issue. The script updates everything perfectly, but the gui doesn’t render on the screen until I select it in the explorer. (As you can see in the GIF, the “wood” frame was in there all along, but it didn’t update on the screen for some reason.

Can you send me the script? That would be good for fixing it.

sendInventory.OnClientEvent:Connect(function(Inventory)
	local ItemsInInventory = inventoryHolder.ItemContainer:GetChildren()
	local ItemsInHotbar = hotbarHolder.ItemContainer:GetChildren()

	print("Client recieved")

	for slot, Item in ipairs(Inventory) do
		if not inventoryHolder.ItemContainer:FindFirstChild(Item.name) then
			local itemFrame = itemTemplate:Clone()
			itemFrame.Amount.Text = Item.amount
			itemFrame.LayoutOrder = slot
			itemFrame.Name = Item.name
			itemFrame.Parent = inventoryHolder.ItemContainer
		else
			if Item.amount > 0 then
				local itemFrame = inventoryHolder.ItemContainer:FindFirstChild(Item.name)
				itemFrame.Amount.Text = Item.amount
			else
				local itemFrame = inventoryHolder.ItemContainer:FindFirstChild(Item.name)
				itemFrame:Destroy()
			end
		end
	end

	for _, v in pairs(ItemsInInventory) do
		if v:IsA("Frame") then
			local found
			for _, k in pairs(Inventory) do
				if k.name == v.Name then
					found = true
					break
				end
			end

			if not found then
				v:Destroy()
			end
		end
	end
end)
1 Like

Have you made sure that the Inventory Holder is visible?

Yes, it is visible. I double checked

And it does make the inventory template and works? Thats odd. I would look around and see if anything it is in is not visible.

1 Like

As I said, it becomes visible one you select the inventory in the explorer, and I dont think the visible property can just change itself from a frame being selected in the explorer. Everything is set to visible.

Huh then that is odd. Is there any more code you have for the inventory?

1 Like

Nope, that is the only code in the entire place which controls the gui. I am starting to think that this might be a bug

Does this print when the event is sent?

Yes, it does print that into the output

did you parent it to the player gui?

2 Likes

He does put it into the item container.

2 Likes

Yes, see the post above explaining it. In the GIF you can see that the inventoryholder is in playergui

2 Likes

So the item container and inventory holder are fine? This is just odd. I’ll play around with GUIs and see if I can replicate this.

1 Like

I know its a bit silly but for future reference add a capital N for Name, it’s a better way of learning.

itemFrame.Name = Item.name
Into
itemFrame.Name = Item.Name

Other than that the code looks fine, if you feel its a bug try restarting studio maybe, I’ve never seen this happen before.

1 Like

Yeah I was thinking it was a bug with .Visible or ZIndex but it doesn’t seem like it anymore.

1 Like