UI Overloaded? Engine Bug? Help needed!

As seen in the following video, whenever I just sell, everything works as intended. But whenever I have the cosmetic menu inside the inventory open (tons of Viewport Frames), AND the Shop with cosmetics (more viewport frames), it all dissapears until you update the frame. If i dont have either of the Menus with viewport frames open, this does not accur.

Here you can see, I literally just selected the item frames in STUDIO and they re-appeared.

It must be some kind of glitch on Roblox itself. I came here to maybe make aware of this, because theres nothing about this online, and I cant seem to fix it either.

3 Likes

No idea what you’re talking about. Can’t really help without some sort of script, but since your system is probably big, it’s not feasible. It’s not a roblox bug, it’s most definitely your scripts.

2 Likes

How and what do my scripts have to do with whats shown in the second video? Im selecting the items within studio!

1 Like

Client (Inventory)

local function SetUpButton(Item)
	local TemplateItem = script.TemplateItem:Clone()
	TemplateItem.ImageButton.ImageLabel.Image = Item.ImageId.Value
	TemplateItem.LayoutOrder = script.RarityColors[Item.Rarity.Value].LayoutOrder.Value
	TemplateItem.ItemName.Value = Item.ItemName.Value
	local TemplateStats = script.TemplateStats:Clone()
	TemplateStats.ItemStats.PhysicalPower.Text = Item.PhysicalPower.Value
	TemplateStats.ItemStats.SpellPower.Text = Item.SpellPower.Value
	if Item.Class.Value == "Helmet" or Item.Class.Value == "Armor" then
		TemplateItem.LayoutOrder += 1
		TemplateStats.ItemStats.Health.Text = Item.Health.Value
	end
	TemplateItem.Parent = script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.ScrollingFrame
	TemplateStats.ItemStats.Upgrades.Text = Item.Upgrades.Value.."/"..Item.MaxUpgrades.Value
	TemplateStats.ItemClass.Value = Item.Class.Value
	TemplateStats.Parent = script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.StatsFrame
	TemplateStats.ItemName.TextLabel.Text = Item.ItemName.Value
	TemplateStats.Requirement.Text = "Level: "..Item.Requirement.Value
	TemplateStats.Rarity.Text = Item.Rarity.Value
	script.RarityGradients[Item.Rarity.Value]:Clone().Parent = TemplateStats.Rarity
	TemplateItem.BackgroundColor3 = script.RarityColors[Item.Rarity.Value].Value
	TemplateItem.ImageButton.BackgroundColor3 = script.RarityColors[Item.Rarity.Value].Inner.Value
	local Connection
	TemplateItem.ImageButton.MouseEnter:Connect(function()
		Player.PlayerGui.Scripts.StatsFrame:ClearAllChildren()
		TemplateItem.ImageButton.HoverSound:Play()
		local StatsTemplate = script.StatsTemplate:Clone()
		StatsTemplate.Parent = Player.PlayerGui.Scripts.StatsFrame
		StatsTemplate.Rarity.Text = Item.Rarity.Value
		script.RarityGradients[Item.Rarity.Value]:Clone().Parent = StatsTemplate.Rarity
		StatsTemplate.Requirement.Text = "Level: "..Item.Requirement.Value
		StatsTemplate.ItemName.TextLabel.Text = Item.ItemName.Value
		if Item.Class.Value == "Helmet" or Item.Class.Value == "Armor" then
			StatsTemplate.ItemStats.Health.Text = Item.Health.Value
		end
		StatsTemplate.ItemStats.Upgrades.Text = Item.Upgrades.Value.."/"..Item.MaxUpgrades.Value
		StatsTemplate.ItemStats.SpellPower.Text = Item.SpellPower.Value
		StatsTemplate.ItemStats.PhysicalPower.Text = Item.PhysicalPower.Value
		Connection = RunService.RenderStepped:Connect(function()
			StatsTemplate.Position = UDim2.new(0, Mouse.X, 0.03, Mouse.Y)
		end)
	end)
	TemplateItem.ImageButton.MouseLeave:Connect(function()
		Player.PlayerGui.Scripts.StatsFrame:ClearAllChildren()
		if Connection then Connection:Disconnect() end
	end)
	if Item.Equipped.Value == true then
		TemplateStats.EquipButton.Text = "Unequip"
		TemplateItem.Size = UDim2.new(1, 0, 1, 0)
		TemplateItem.Position = UDim2.new(0, 0, 0, 0)
		TemplateItem.Parent = script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner[Item.Class.Value]
	end
	if Item.Locked.Value == true then
		TemplateStats.LockButton.Text = "Locked"
	end
	TemplateItem.ImageButton.MouseButton1Click:Connect(function()
		TemplateItem.ImageButton.ClickSound:Play()
		for i,v in pairs(script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.StatsFrame:GetChildren()) do
			if v ~= TemplateStats then
				v.Visible = false
			end
		end
		if TemplateStats.Visible == true then
			TemplateStats.Visible = false
		else
			TemplateStats.Visible = true
		end
	end)
	Item.Equipped:GetPropertyChangedSignal("Value"):Connect(function()
		if TemplateStats ~= nil then
			if TemplateStats:FindFirstChild("EquipButton") then
				if Item.Equipped.Value == true then
					TemplateStats.EquipButton.Text = "Unequip"
				else
					TemplateStats.EquipButton.Text = "Equip"
				end
			end
		end
	end)
	local debounce = false
	TemplateStats.EquipButton.MouseButton1Click:Connect(function()
		if debounce or Player.IsDead.Value == true then return end
		debounce = true
		if Item.Requirement.Value <= Player.Level.Value or Player.UserId == 441897347 or Player.UserId == 100749980 then
			Player.PlayerGui.Scripts.StatsFrame:ClearAllChildren()
			local EquipSound = script.EquipSound:Clone()
			EquipSound.Parent = script.Parent
			EquipSound:Play()
			DebrisService:AddItem(EquipSound, 1)
			Player.Character.Humanoid:LoadAnimation(script.EquipAnimation):Play()
			for i,v in pairs(script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner[Item.Class.Value]:GetDescendants()) do
				if v.Name == "TemplateItem" then
					v.Size = script.TemplateItem.Size
					v.Parent = script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.ScrollingFrame
				end
			end
			if Item.Equipped.Value == true then
				ReplicatedStorage.Remotes.ItemRemote:FireServer("Unequip", Item)
			else
				TemplateItem.Size = UDim2.new(1, 0, 1, 0)
				TemplateItem.Position = UDim2.new(0, 0, 0, 0)
				TemplateItem.Parent = script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner[Item.Class.Value]
				ReplicatedStorage.Remotes.ItemRemote:FireServer("Equip", Item)
				for i,v in pairs(script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.StatsFrame:GetChildren()) do
					if v.ItemClass.Value == Item.Class.Value then
						v.EquipButton.Text = "Equip"
					end
				end
			end
			task.wait(1)
		else
			script.DenySound:Play()
			if Player.IsDead.Value == true then
				TemplateStats.EquipButton.Text = "Player Dead."
			else
				TemplateStats.EquipButton.Text = "Low Level."
			end
			task.wait(1)
			TemplateStats.EquipButton.Text = "Equip"
		end
		debounce = false
	end)
	TemplateStats.LockButton.MouseButton1Click:Connect(function()
		script.ClickSound:Play()
		ReplicatedStorage.Remotes.ItemRemote:FireServer("Lock", Item)
	end)
	Item.Locked:GetPropertyChangedSignal("Value"):Connect(function()
		if TemplateStats and TemplateStats:FindFirstChild("LockButton") then
			if Item.Locked.Value == true then
				TemplateStats.LockButton.Text = "Locked"
			else
				TemplateStats.LockButton.Text = "Unlocked"
			end
		end
	end)
	TemplateStats.LockButton.MouseEnter:Connect(function()
		script.HoverSound:Play()
	end)
	TemplateStats.EquipButton.MouseEnter:Connect(function()
		script.HoverSound:Play()
	end)
end

local function UpdateInventory()
	script.Parent.MainFrame.Items.ItemsFrame.ItemAmount.Text = #Player.Data.Gear:GetChildren().."/2500"
	script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.StatsFrame:ClearAllChildren()
	for i,v in pairs(script.Parent.MainFrame.Items.ItemsFrame.ItemsInner.ScrollingFrame:GetChildren()) do
		if v:IsA("Frame") then
			v:Destroy()
		end
	end
	if script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Helmet:FindFirstChild("TemplateItem") then
		script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Helmet:FindFirstChild("TemplateItem"):Destroy()
	end
	if script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Armor:FindFirstChild("TemplateItem") then
		script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Armor:FindFirstChild("TemplateItem"):Destroy()
	end
	if script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Weapon:FindFirstChild("TemplateItem") then
		script.Parent.MainFrame.Items.EquippedMenu.EquippedMenuInner.Weapon:FindFirstChild("TemplateItem"):Destroy()
	end
	for i,Item in pairs(Player.Data.Gear:GetChildren()) do
		SetUpButton(Item)
	end
end

Player.Data.Gear.ChildAdded:Connect(function(Item)
	repeat task.wait() until Item:FindFirstChild("ItemName") and Item.ItemName.Value ~= ""
	script.Parent.MainFrame.Items.ItemsFrame.ItemAmount.Text = #Player.Data.Gear:GetChildren().."/2500"
	task.spawn(function()
		local DropFrame = script.TemplateDrop:Clone()
		DropFrame.Parent = Player.PlayerGui.Scripts.LootFrame
		local LootSound = script.RaritySounds.LootSound:Clone()
		LootSound.Parent = DropFrame
		LootSound:Play()
		DebrisService:AddItem(DropFrame, 4.6)
		if script.RaritySounds:FindFirstChild(Item.Rarity.Value) then
			local DropSound = script.RaritySounds[Item.Rarity.Value]:Clone()
			DropSound.Parent = DropFrame
			DropSound:Play()
		end
		DropFrame.ItemInner.Frame.ImageLabel.Image = Item.ImageId.Value
		DropFrame.BackgroundColor3 = script.RarityColors[Item.Rarity.Value].Value
		DropFrame.GlowFrame.ImageColor3 = script.RarityColors[Item.Rarity.Value].Inner.Value
		DropFrame.ItemInner.BackgroundColor3 = script.RarityColors[Item.Rarity.Value].Inner.Value
		DropFrame.ItemInner.Frame.BackgroundColor3 = script.RarityColors[Item.Rarity.Value].Inner.Value
		TweenService:Create(DropFrame, TweenInfo.new(0.3), {Transparency = 0}):Play()
		TweenService:Create(DropFrame.ItemInner, TweenInfo.new(0.3), {Transparency = 0}):Play()
		TweenService:Create(DropFrame.GlowFrame, TweenInfo.new(0.3), {ImageTransparency = 0}):Play()
		TweenService:Create(DropFrame.ItemInner.Frame.ImageLabel, TweenInfo.new(0.3), {ImageTransparency = 0}):Play()
		task.wait(3)
		TweenService:Create(DropFrame, TweenInfo.new(1.6), {Transparency = 1}):Play()
		TweenService:Create(DropFrame.ItemInner, TweenInfo.new(1.6), {Transparency = 1}):Play()
		TweenService:Create(DropFrame.GlowFrame, TweenInfo.new(1.6), {ImageTransparency = 1}):Play()
		TweenService:Create(DropFrame.ItemInner.Frame.ImageLabel, TweenInfo.new(1.6), {ImageTransparency = 1}):Play()
	end)
	SetUpButton(Item)
end)

ReplicatedStorage.Remotes.ReloadInventory.OnClientEvent:Connect(UpdateInventory)

Server (Sell)

elseif ToDo == "Sell" then
			if typeof(Item) == "table" and #Item > 0 then
				for _,SellItem in Item do
					if SellItem:IsDescendantOf(Player) and Player.IsDead.Value == false then
						if SellItem.Locked.Value == false then
							if SellItem.Equipped.Value == true then
								if Player.Character ~= nil and Player.Character.Parent ~= nil then
									Player.Character.Humanoid:LoadAnimation(script.EquipAnimation):Play()
								end
								for i,v in pairs(Player.Character[SellItem.Class.Value]:GetChildren()) do
									if v:IsA("Model") then
										v:Destroy()
									end
								end
								for i,v in pairs(Player.Data.Equipped[SellItem.Class.Value]:GetDescendants()) do
									if v:IsA("BoolValue") then
										v.Value = false
									elseif v:IsA("IntValue") then
										v.Value = 0
									elseif v.Name == "Rarity" then
										v.Value = "Default"
									elseif v:IsA("StringValue") then
										v.Value = ""
									end
								end
								Player.Health.Value = 100
								Player.Health.Value = math.max(Player.Health.Value + Player.Data.Equipped.Helmet.Health.Value + Player.Data.Equipped.Armor.Health.Value, 100)
								if SellItem.Class.Value == "Weapon" then
									Player.Animation.Value = "None"
								end
								if Player.IsInDungeon.Value == false then
									Player.Character.Humanoid.MaxHealth = (Player.Health.Value * Player.HealthMultiplier.Value)
									Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
								else
									Player.Character.Humanoid.MaxHealth = (Player.Health.Value * Player.HealthMultiplier.Value)
									if Player.Character.Humanoid.Health >= Player.Character.Humanoid.MaxHealth then
										Player.Character.Humanoid.Health = (Player.Health.Value * Player.HealthMultiplier.Value)
									end
								end
							end
							if Player.VIP.Value == true and Player.Premium.Value == true then
								ServerStorage.Data[Player.Name].Coins.Value += (SellItem.SellPrice.Value * 2)
							else
								ServerStorage.Data[Player.Name].Coins.Value += SellItem.SellPrice.Value
							end
							SellItem:Destroy()
						end
					end
				end
				ReplicatedStorage.Remotes.ReloadInventory:FireClient(Player)
			end
1 Like

Here’s a tip, try to not nest your code as much as possible, only use it when needed.

1 Like

What do you mean by that? Im not a native english speaker so this is quite difficult ^^’

1 Like

you sure the zindex has nothing to do with it?

1 Like

I just bypassed the issue by adding this.

if script.Parent.MainFrame.Cosmetics.Visible == true then
	script.Parent.MainFrame.Cosmetics.Visible = false
	script.Parent.MainFrame.Items.Visible = true
end

Code runs when you sell

I still definitely want to know why this is happening tho!

2 Likes

Oh alright. But you haven’t answered my question, you know how frame zindex works right?

1 Like

The TemplateItem frame has a ZIndex of 3. And yes, it keeps stuff infront of other frames/ui elements I belive.

2 Likes

hmmm, weird. Usually the Zindex is the culprit when dealing with frames that don’t appear. Well you found a bypass, so hopefully it works 100% of the time.

1 Like

This is soo wierd! You saw the video right? What does selecting the items within studio… I just cant wrap it my head around this. I hope a roblox developer see’s this since this is most definitely a issue with too much stuff going on on the Players Screen.

I might try just making all cosmetic frames invisible once you close out of the inventory, and make the visible again upon opening the inventory. Will keep you updated!

1 Like

Still happening. My first solution seems to work for now.

2 Likes

Yeah it’s hella weird. I’m working on a windows 11 UI, so hopefully this doesn’t happen to me :sob:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.