Recreating roblox explorer panel has ran into an issue

  1. What do you want to achieve? Keep it simple and clear!
    Its hard for me to explain so watch this video - ROBLOX Devforum support (youtube.com)

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?


local function LoadInExplorer(plr)
	local ScreenGui = plr:WaitForChild("PlayerGui"):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
			if game:FindFirstChild(v.Name, true):GetAttribute("ID") ~= v:GetAttribute("ID") then

			end
		end	
		v:Destroy()
	end

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

	local function FindIndex(Name, Parent)
		local Return = nil
		for i, v in pairs(Parent) do
			if string.lower(tostring(v)) == string.lower(tostring(Name)) then
				Return = i
			end
		end
		return Return
	end

	local Explorer_ShownTable = {}

	table.clear(Explorer_ShownTable)

	for _, v in pairs(game:GetDescendants()) do
		if game:FindFirstChild(v.Name, true) then
			table.insert(Explorer_ShownTable, v)
		end
	end

	local function LookForInstanceWithID(ID)
		for _, v in pairs(ScreenGui:WaitForChild("Explorer"):GetDescendants()) do
			if v:GetAttribute("ID") == ID then
				return v
			end
		end
	end

	local function Load_Instances_Explorer_Data_A(v, Text)
		if ExplorerInstances_Table[v.Name..v:GetAttribute("ID")] then
			Text:SetAttribute("Load", ExplorerInstances_Table[v.Name..v:GetAttribute("ID")].Load)
			Text:SetAttribute("ID", ExplorerInstances_Table[v.Name..v:GetAttribute("ID")].ID)
		end
	end

	local function RunLoop()
		for index, v in pairs(Explorer_ShownTable) do
			task.spawn(function()
				local s, e = pcall(function()
					if v.Name ~= "ReplicatedStorage" and v.Name ~= "Workspace" and v.Name ~= "StarterGui" and v.Parent == game then return end
					--if v.Name ~= "Workspace" and v.Parent == game then return end
					--[[if ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Name, true) then
						if ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Name, true):GetAttribute("ID") == v:GetAttribute("ID") then
							print(ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Name, true).Name, ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Name, true):GetAttribute("ID"))
							return
						end
					end--]]

					local Text = game:GetService("ReplicatedStorage"):WaitForChild("Assets"):WaitForChild("Text_Label"):Clone()

					if game.Players:FindFirstChild(v.Name) then
						Text:Destroy()
						return
					end

					local suc, em = pcall(function()
						if not v:GetAttribute("ID") then
							v:SetAttribute("ID", math.random(1, 500000))
							Text:SetAttribute("ID", v:GetAttribute("ID"))
						end
					end)
					
					if v.Parent == game then
						Text.Parent = ScreenGui:WaitForChild("Explorer")
						Text:SetAttribute("Load", false)
					else
						Text.Parent = LookForInstanceWithID(v.Parent:GetAttribute("ID")) --ScreenGui:WaitForChild("Explorer"):FindFirstChild(v.Parent.Name, true)
						if not Text:GetAttribute("Load") then
							if not ExplorerInstances_Table[v.Name..v:GetAttribute("ID")] then
								Text:SetAttribute("Load", true)
							else
								Load_Instances_Explorer_Data_A(v, Text)
							end
						end
					end

					Text.Name = v.Name
					Text.Text = v.Name
					
					Load_Instances_Explorer_Data_A(v,  Text)

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

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

						for _, objects in pairs(ScreenGui:WaitForChild("Explorer"):GetDescendants()) do
							local Found = false
							for _, parts in pairs(game:GetDescendants()) do
								if parts:GetAttribute("ID") then
									if parts:GetAttribute("ID") == objects:GetAttribute("ID") then
										Found = true
										break
									end
								end
							end

							if Found == false then
								ExplorerInstances_Table[objects.Name..objects:GetAttribute("ID")] = nil
								if ExplorerInstances_Table[objects.Name..objects:GetAttribute("ID")] then
									warn("ITEM STILL EXISTS: ", ExplorerInstances_Table[objects.Name..objects:GetAttribute("ID")].Name)
								end
							else
								ExplorerInstances_Table[objects.Name..objects:GetAttribute("ID")] = {Name = objects.Name..objects:GetAttribute("ID"), Load = objects:GetAttribute("Load"), ID = objects:GetAttribute("ID")}
							end
						end
						
						LoadInExplorer(plr)
					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((Text.Size.X.Scale / X_Division),(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)
			end)
		end
	end
	Load_Overview_Frame(plr)
	RunLoop()
end
3 Likes

I fixed the issue, it was a math issue.

3 Likes

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