UI Objects overlapping

  1. What do you want to achieve? Keep it simple and clear!
    I want UI Objects in my recreated version of the ROBLOX explorer panel to stop overlapping.

  2. What is the issue? Include screenshots / videos if possible!
    https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYzg2M3owOG83dGZ6Z2JtYnVzdTh5YjhrOW54ZGJsdXV3NjdwaTU5bCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/gyOqYNGxZBusCaxvMG/giphy.gif – wasn’t able to upload the video because of an uploading error.

UI Objects overlapping: ```
local function LoadInExplorer()
local ScreenGui = script.Parent:WaitForChild(“ScreenGui”)

for _, v in pairs(ScreenGui:WaitForChild("Explorer"):GetDescendants()) do
	if not game:FindFirstChild(v.Name, true) and v:IsA("ImageLabel") or v:IsA("ImageButton") then
		v:Destroy()
	end
end

print(game:GetChildren())

local function FindParentLabel(child)
	return ScreenGui:WaitForChild("Explorer"):FindFirstChild(child.Parent.Name, true)
end

local function RePositionInstances_init()
	for _, v in pairs(ScreenGui:WaitForChild("Explorer"):GetDescendants()) do

	end
end

local function RunLoop()
	for index, v in pairs(game:GetDescendants()) do
		--if v.Name ~= "ReplicatedStorage" and v.Name ~= "Workspace" and v.Name ~= "StarterGui" and v.Parent == game then continue end
		if v.Name ~= "Workspace" and v.Parent == game then continue end
		if ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Name, true) then continue end
		local Text  = game:GetService("ReplicatedStorage"):WaitForChild("Assets"):WaitForChild("Text_Label"):Clone()
		if v.Parent == game then
			Text.Parent = ScreenGui:WaitForChild("Explorer")
			Text:SetAttribute("Load", false)
		else
			Text.Parent = ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Parent.Name, true)
			if not Text:GetAttribute("Load") then
				Text:SetAttribute("Load", true)
			end
		end

		Text.Name = v.Name
		Text.Text = v.Name

		if Text.Parent then
			if Text.Parent:GetAttribute("Load") == true then
				Text:Destroy()
				continue
			end
		end

		Text.MouseButton1Click:Connect(function()
			if Text:GetAttribute("Load") == true then
				Text:SetAttribute("Load", false)
			else
				Text:SetAttribute("Load", true)
			end
			RunLoop()
		end)

		local function RePosition_Explorer_Instances()
			local succ, errormssge = pcall(function()
				if Text.Parent ~= ScreenGui:WaitForChild("Explorer") then
					local X_Division = 1
					Text.Position = UDim2.new(0 + (Text.Size.X.Scale / X_Division),0 + (Text.Size.X.Offset / X_Division), Text.Size.Y.Scale * #Text.Parent:GetDescendants(), Text.Size.Y.Offset * #Text.Parent:GetDescendants())
				else
					Text.Position = UDim2.new(0,0,Text.Size.Y.Scale * #Text.Parent:GetDescendants(),(Text.Size.Y.Offset * #Text.Parent:GetDescendants()))
				end
			end)
		end
		
		RePosition_Explorer_Instances()
	end
	--Position_Explorer_Instances()
end
RunLoop()

end

4 Likes

You can use Zindex to order your gui correctly.

1 Like

The that will not work, instead of overlapping I want them to position themselves relative on the Y axis

1 Like

If I understood your problem correctly, you can store a reference to the Gui that’s currently open and close it before opening a new Gui and repeat this process

1 Like

I want it to work like the Roblox studio explorer panel.

1 Like

The Gui you’re making seems to work quite differently than Studio’s Explorer panel, and in all honesty I don’t know why you’d want to change the behavior of the default panel since it’s already quite simple and straightforward to use

If you wish to position the Gui relative to the Y axis, I think using a UI constraint such as a UIListLayout would work to achieve that without needing to code

1 Like

True but UIListLayout doesn’t seem to work as intended, the reason I want to use the explorer in the game is because I’m allowing users to create their own games.

2 Likes

For looping through the game seems to show things that aren’t actually displayed in the explorer panel.

1 Like

Well, there are other UI constraints you could try like for example a UIGridLayout that might work closer to your target. Sometimes UI constraints require tinkering with their properties or restructuring of your Gui in-order to be able to work as you wish

That’s because by using game:GetDescendants() you’ll be looping through all Instances present within your game at the time it is called. The Explorer filters out some of those Instances in-order to reduce clutter and prioritize Instances that are most commonly used when developing in Studio

2 Likes

I found the fix, just message me if you want it.

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