Create(explorerPanel,{BackgroundColor3=GuiColor.Field,BorderColor3=GuiColor.Border;Active=true})local N=(explorerPanel.Parent:WaitForChild("\083\101\116\116\105\110\103\115\080\097\110\101\108")):WaitForChild("\071\101\116\083\101\116\116\105\110\103")local y=(explorerPanel.Parent:WaitForChild("\080\114\111\112\101\114\116\105\101\115\070\114\097\109\101")):WaitForChild("\071\101\116\065\112\105")local o=(explorerPanel.Parent:WaitForChild("\080\114\111\112\101\114\116\105\101\115\070\114\097\109\101")):WaitForChild("\071\101\116\065\119\097\105\116\105\110\103")local z=(explorerPanel.Parent:WaitForChild("\080\114\111\112\101\114\116\105\101\115\070\114\097\109\101")):WaitForChild("\083\101\116\065\119\097\105\116\105\110\103")local A=explorerPanel.Parent:WaitForChild("\067\097\117\116\105\111\110")local Y=explorerPanel.Parent:WaitForChild("\084\097\098\108\101\067\097\117\116\105\111\110")local e=explorerPanel.Parent:WaitForChild("\067\097\108\108\082\101\109\111\116\101")local G local K local k=Create("\070\114\097\109\101",{Name="\076\105\115\116",BackgroundTransparency=1,ClipsDescendants=true;Position=UDim2_new(0,0,0,HEADER_SIZE);Size=UDim2_new(1,-GUI_SIZE,1,-HEADER_SIZE);Parent=explorerPanel})local B=ScrollBar(false)B.PageIncrement=1 Create(B.GUI,{Position=UDim2_new(1,-GUI_SIZE,0,HEADER_SIZE);Size=UDim2_new(0,GUI_SIZE,1,-HEADER_SIZE);Parent=explorerPanel})local E=ScrollBar(true)E.PageIncrement=GUI_SIZE Create(E.GUI,{Position=UDim2_new(0,0,1,-GUI_SIZE),Size=UDim2_new(1,-GUI_SIZE,0,GUI_SIZE),Visible=false,Parent=explorerPanel})local D=Create("\070\114\097\109\101",{Name="\072\101\097\100\101\114",BackgroundColor3=GuiColor.Background,BorderSizePixel=0;Position=UDim2_new(0,0,0,0);Size=UDim2_new(1,0,0,HEADER_SIZE),Parent=explorerPanel,Create("\084\101\120\116\076\097\098\101\108",{Text="\069\120\112\108\111\114\101\114",BackgroundTransparency=1;TextColor3=GuiColor.Text,TextXAlignment="\076\101\102\116";Font=FONT;FontSize=FONT_SIZE;Position=UDim2_new(0,4,0,0),Size=UDim2_new(1,-4,.5,0)})})local O=Create("\084\101\120\116\066\111\120",{PlaceholderText="\070\105\108\116\101\114 \119\111\114\107\115\112\097\099\101\046\046\046";PlaceholderColor3=Color3_fromRGB(153,153,153);Text="",BackgroundTransparency=.8;TextColor3=GuiColor.Text,TextXAlignment="\076\101\102\116",Font=FONT;FontSize=FONT_SIZE;Position=UDim2_new(0,4,.5,0),Size=UDim2_new(1,-8,.5,-2),Create("\085\073\080\097\100\100\105\110\103",{PaddingLeft=UDim.new(0,4)})})O.Parent=D SetZIndexOnChanged(explorerPanel)local function n(N,y,o)return Color3_new(N/255,y/255,o/255)end local w={Font=Enum.Font.Arial;Margin=5;Black=Color3_fromRGB(0,0,5);Black2=Color3_fromRGB(24,24,29),White=Color3_fromRGB(244,244,249),WhiteOver=Color3_fromRGB(200,200,205);Hover=Color3_fromRGB(2,128,149),Hover2=Color3_fromRGB(5,102,146)}local u={Font=w.Font,FontSize=Enum.FontSize.Size14;TextXAlignment=Enum.TextXAlignment.Left;TextColor=w.White;TextColorOver=w.WhiteOver,TextLockedColor=Color3_fromRGB(155,155,160);Height=24,BorderColor=Color3_fromRGB(54,54,55),BackgroundColor=w.Black2,BackgroundColorAlternate=Color3_fromRGB(32,32,37),BackgroundColorMouseover=Color3_fromRGB(40,40,45),TitleMarginLeft=15}local s={Font=w.Font,FontSize=Enum.FontSize.Size14;TextColor=Color3_fromRGB(255,255,260);TextColorOver=u.TextColorOver,TextXAlignment=Enum.TextXAlignment.Left;Height=20,BackColor=w.Black2,BackColorOver=w.Hover2,BorderColor=Color3_fromRGB(45,45,50);BorderSizePixel=0;ArrowColor=Color3_fromRGB(80,80,83);ArrowColorOver=w.Hover}local S={BoxSize=13;BorderSizePixel=0;BorderColor=Color3_fromRGB(53,53,55);FrameColor=Color3_fromRGB(53,53,55);Size=20;Padding=4,ColorsPerRow=8,OuterBorder=1;OuterBorderColor=w.Black}local V local q local t local h function ClassCanCreate(N)local y,o=pcall(function()Instance_new(N)end)if o then return false else return true end end function GetClasses()if h==nil then return{}end local N={}for y,o in pairs(h.Classes)do if ClassCanCreate(o.Name)then table.insert(N,o.Name)end end return N end local function W(N,y)table.sort(N,function(N,o)return N[y]<o[y]end)end local function F(N)local y=N.Tags if y then for N,y in pairs(y)do if y=="\068\101\112\114\101\099\097\116\101\100"or y=="\072\105\100\100\101\110"or y=="\082\101\097\100\079\110\108\121"or y=="\078\111\116\083\099\114\105\112\116\097\098\108\101"then return true end end end return false end local function j(N)local y=h.Classes[N]local o={}if not y then return o end while y do if y.Name=="\073\110\115\116\097\110\099\101"then break end for N,y in pairs(y.Members)do if y.MemberType=="\070\117\110\099\116\105\111\110"and not F(y)then table.insert(o,y)end end y=h.Classes[y.Superclass]end W(o,"\078\097\109\101")return o end function GetFunctions()if h==nil then return{}end local N=(SelectionVar()):Get()if#N==0 then return end local y=N[1]local o={}for N,y in pairs(j(y.ClassName))do table.insert(o,y)end return o end function CreateInsertObjectMenu(N,y,o,z)local A=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local Y=explorerPanel.Parent.AbsoluteSize.y if#N==0 then return end table.sort(N,function(N,y)return N<y end)local e=Instance_new("\070\114\097\109\101")e.Name="\073\110\115\101\114\116\079\098\106\101\099\116"e.Size=UDim2_new(0,200,1,0)e.BackgroundTransparency=1 e.Active=true local G=nil local K=nil local k=false local B=s.BorderSizePixel local function E()k=false if e then q.Visible=false end end local function D()k=true G=Instance_new("\083\099\114\111\108\108\105\110\103\070\114\097\109\101")G.Size=UDim2_new(0,200,1,0)G.CanvasSize=UDim2_new(0,200,0,#N*s.Height)G.Position=UDim2_new(0,B,0,0)G.BackgroundTransparency=0 G.BackgroundColor3=s.BackColor G.BorderColor3=s.BorderColor G.BorderSizePixel=s.BorderSizePixel G.TopImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.MidImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.BottomImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.Active=true G.ZIndex=5 G.Parent=e local function y(N)z(N)E()end for N,o in pairs(N)do local z=CreateRightClickMenuItem(o,function()y(o)end,1)z.Size=UDim2_new(1,0,0,20)z.Position=UDim2_new(0,0,0,(N-1)*s.Height)z.ZIndex=G.ZIndex z.Parent=G end end D()return e end function CreateFunctionCallerMenu(N,y,o,z)local A=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local Y=explorerPanel.Parent.AbsoluteSize.y if#N==0 then return end table.sort(N,function(N,y)return N.Name<y.Name end)local e=Instance_new("\070\114\097\109\101")e.Name="\073\110\115\101\114\116\079\098\106\101\099\116"e.Size=UDim2_new(0,200,1,0)e.BackgroundTransparency=1 e.Active=true local G=nil local K=nil local k=false local B=s.BorderSizePixel local function E()k=false if e then q.Visible=false end end local function D()k=true G=Instance_new("\083\099\114\111\108\108\105\110\103\070\114\097\109\101")G.Size=UDim2_new(0,300,1,0)G.CanvasSize=UDim2_new(0,300,0,#N*s.Height)G.Position=UDim2_new(0,B,0,0)G.BackgroundTransparency=0 G.BackgroundColor3=s.BackColor G.BorderColor3=s.BorderColor G.BorderSizePixel=s.BorderSizePixel G.TopImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.MidImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.BottomImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\098\108\097\099\107\066\107\103\095\115\113\117\097\114\101\046\112\110\103"G.Active=true G.ZIndex=5 G.Parent=e local function y(N)local y=""y=y.."\040"for o,z in pairs(N.Parameters)do y=y..(z.Type.Name..(" "..z.Name))if o<#N.Parameters then y=y.."\044 "end end y=y.."\041"return y end local function o(N)z(N)E()end for N,z in pairs(N)do local A=CreateRightClickMenuItem(z.ReturnType.Name..(" "..(z.Name..y(z))),function()o(z)end,2)A.Size=UDim2_new(1,0,0,20)A.Position=UDim2_new(0,0,0,(N-1)*s.Height)A.ZIndex=G.ZIndex A.Parent=G end end D()return e end function CreateInsertObject()if not q then return end q.Visible=true if V and q.Visible then q.Position=UDim2_new(0,V.Position.X.Offset-V.Size.X.Offset,0,0)end if q.Visible then q.Parent=explorerPanel.Parent end end function CreateFunctionCaller(N)if t then t:Destroy()t=nil end t=CreateFunctionCallerMenu(GetFunctions(),"",false,function(N)t:Destroy()t=nil local y=(SelectionVar()):Get()for y,o in pairs(y)do local z=RemoteEvent:InvokeServer("\067\097\108\108\070\117\110\099\116\105\111\110",o,N.Name)print(z)pcall(function()print("\070\117\110\099\116\105\111\110",N.Name,"\111\110",o,"\058",unpack(z))end)end DestroyRightClick()end)if V and t then t.Position=UDim2_new(0,V.Position.X.Offset-V.Size.X.Offset*1.5,0,0)end if t then t.Parent=explorerPanel.Parent end end function CreateRightClickMenuItem(N,y,o)local z=Instance_new("\084\101\120\116\066\117\116\116\111\110")z.Font=s.Font z.FontSize=s.FontSize z.TextColor3=s.TextColor z.BackgroundColor3=s.BackColor z.AutoButtonColor=false z.BorderSizePixel=0 z.TextTransparency=1 z.Active=true if N then local A=Instance_new("\084\101\120\116\076\097\098\101\108")A.Size=UDim2_new(1,0,1,0)A.Font=s.Font A.FontSize=Enum.FontSize.Size11 A.TextColor3=s.TextColor A.TextXAlignment=s.TextXAlignment A.BackgroundTransparency=1 A.BorderSizePixel=0 A.ZIndex=5 A.Text=N z.Text=N A.Parent=z if o==2 then A.FontSize=Enum.FontSize.Size11 A.Size=UDim2_new(1,-16,1,0)A.Position=UDim2_new(0,16,0,0)else if o==1 or ExplorerIndex[N]then if ExplorerIndex[N]then local y=Icon(nil,ExplorerIndex[N]or 0)y.Position=UDim2_new(0,2,0,2)y.Size=UDim2_new(0,16,0,16)y.IconMap.ZIndex=5 y.Parent=z else local y=ClassIcon(nil,ClassIndex[N]or 0)y.Position=UDim2_new(0,2,0,2)y.Size=UDim2_new(0,16,0,16)y.IconMap.ZIndex=5 y.Parent=z end end A.Size=UDim2_new(1,-32,1,0)A.Position=UDim2_new(0,32,0,0)end z.MouseEnter:connect(function()z.TextColor3=s.TextColorOver z.BackgroundColor3=s.BackColorOver if not o and q then if q.Visible==false and z.Text=="\073\110\115\101\114\116 \079\098\106\101\099\116"then CreateInsertObject()elseif q.Visible and z.Text~="\073\110\115\101\114\116 \079\098\106\101\099\116"then q.Visible=false end end if not o then if t and z.Text~="\067\097\108\108 \070\117\110\099\116\105\111\110"then t:Destroy()t=nil elseif z.Text=="\067\097\108\108 \070\117\110\099\116\105\111\110"then CreateFunctionCaller()end end end)z.MouseLeave:connect(function()z.TextColor3=s.TextColor z.BackgroundColor3=s.BackColor end)z.MouseButton1Click:connect(function()z.TextColor3=s.TextColor z.BackgroundColor3=s.BackColor y(N)end)else local N=Instance_new("\070\114\097\109\101",z)N.Size=UDim2_new(1,-20,0,1)N.Position=UDim2_new(0,16,0,2)N.BackgroundColor3=s.BorderColor N.BorderSizePixel=0 N.ZIndex=5 end return z end function CreateRightClickMenu(N,y,o,z)local A=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local Y=Instance_new("\084\101\120\116\066\117\116\116\111\110")Y.Name="\068\114\111\112\068\111\119\110"Y.Size=UDim2_new(0,200,0,0)Y.BackgroundTransparency=1 Y.AutoButtonColor=false Y.Active=false local e=nil local G=nil local K=false local k=s.BorderSizePixel local function B()K=false if Y then Y:Destroy()DestroyRightClick()end end local function E()K=true e=Instance_new("\070\114\097\109\101")e.Size=UDim2_new(0,200,0,0)for N,y in pairs(N)do if y then e.Size=e.Size+UDim2_new(0,0,0,20)else e.Size=e.Size+UDim2_new(0,0,0,7)end end Y.Size=e.Size+UDim2_new(0,0,0,6)e.Position=UDim2_new(0,0,0,0)e.BackgroundTransparency=0 e.BackgroundColor3=s.BackColor e.BorderColor3=s.BorderColor e.BorderSizePixel=s.BorderSizePixel e.Active=true e.ZIndex=5 e.Parent=Y local function y(N)z(N)B()end local o for N,z in pairs(N)do local A=CreateRightClickMenuItem(z,function()y(z)end)if z then A.Size=UDim2_new(1,0,0,20)else A.Size=UDim2_new(1,0,0,7)end if o then A.Position=UDim2_new(0,0,0,o.Position.Height.Offset+o.Size.Height.Offset)end A.ZIndex=e.ZIndex A.Parent=e o=A end end E()return Y end function checkMouseInGui(N)if N==nil then return false end local y=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer:GetMouse()local o=N.AbsolutePosition local z=N.AbsoluteSize if y.X>=o.x and(y.X<=o.x+z.x and(y.Y>=o.y and y.Y<=o.y+z.y))then return true else return false end end local J={}local function d(N)N.Parent=nil RemoteEvent:InvokeServer("\068\101\108\101\116\101",N)end local b do local N=Create("\084\101\120\116\076\097\098\101\108",{Name="\084\101\120\116\087\105\100\116\104";TextXAlignment="\076\101\102\116",TextYAlignment="\067\101\110\116\101\114",Font=FONT;FontSize=FONT_SIZE;Text="",Position=UDim2_new(0,0,0,0);Size=UDim2_new(1,0,1,0);Visible=false;Parent=explorerPanel})function b(y)N.Text=y return N.TextBounds.x end end local R=false


Create(explorerPanel,{
	BackgroundColor3 = GuiColor.Field;
	BorderColor3 = GuiColor.Border;
	Active = true;
})

local SettingsRemote = explorerPanel.Parent:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local GetApiRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetApi")
local GetAwaitRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetAwaiting")
local bindSetAwaiting = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("SetAwaiting")

local CautionWindow = explorerPanel.Parent:WaitForChild("Caution")
local TableCautionWindow = explorerPanel.Parent:WaitForChild("TableCaution")

local RemoteWindow = explorerPanel.Parent:WaitForChild("CallRemote")

local CurrentRemoteWindow

local lastSelectedNode

local listFrame = Create('Frame',{
	Name = "List";
	BackgroundTransparency = 1;
	ClipsDescendants = true;
	Position = UDim2_new(0,0,0,HEADER_SIZE);
	Size = UDim2_new(1,-GUI_SIZE,1,-HEADER_SIZE);
	Parent = explorerPanel;
})

local scrollBar = ScrollBar(false)
scrollBar.PageIncrement = 1
Create(scrollBar.GUI,{
	Position = UDim2_new(1,-GUI_SIZE,0,HEADER_SIZE);
	Size = UDim2_new(0,GUI_SIZE,1,-HEADER_SIZE);
	Parent = explorerPanel;
})

local scrollBarH = ScrollBar(true)
scrollBarH.PageIncrement = GUI_SIZE
Create(scrollBarH.GUI,{
	Position = UDim2_new(0,0,1,-GUI_SIZE);
	Size = UDim2_new(1,-GUI_SIZE,0,GUI_SIZE);
	Visible = false;
	Parent = explorerPanel;
})

local headerFrame = Create('Frame',{
	Name = "Header";
	BackgroundColor3 = GuiColor.Background;
	BorderSizePixel = 0;
	Position = UDim2_new(0,0,0,0);
	Size = UDim2_new(1,0,0,HEADER_SIZE);
	Parent = explorerPanel;
	Create('TextLabel',{
		Text = "Explorer";
		BackgroundTransparency = 1;
		TextColor3 = GuiColor.Text;
		TextXAlignment = 'Left';
		Font = FONT;
		FontSize = FONT_SIZE;
		Position = UDim2_new(0,4,0,0);
		Size = UDim2_new(1,-4,0.5,0);
	});
})

local explorerFilter = 	Create('TextBox',{
	PlaceholderText = "Filter workspace...";
	PlaceholderColor3 = Color3_fromRGB(153, 153, 153);
	Text = "";
	BackgroundTransparency = 0.8;
	TextColor3 = GuiColor.Text;
	TextXAlignment = 'Left';
	Font = FONT;
	FontSize = FONT_SIZE;
	Position = UDim2_new(0,4,0.5,0);
	Size = UDim2_new(1,-8,0.5,-2);
	Create('UIPadding',{
		PaddingLeft = UDim.new(0, 4)
	})
});
explorerFilter.Parent = headerFrame

SetZIndexOnChanged(explorerPanel)

local function CreateColor3(r, g, b) return Color3_new(r/255,g/255,b/255) end

local Styles = {
	Font = Enum.Font.Arial,
	Margin = 5,
	Black = Color3_fromRGB(0,0,5),
	Black2 = Color3_fromRGB(24, 24, 29),
	White = Color3_fromRGB(244,244,249),
	WhiteOver = Color3_fromRGB(200,200,205),
	Hover = Color3_fromRGB(2, 128, 149),
	Hover2 = Color3_fromRGB(5, 102, 146)
}

local Row = {
	Font = Styles.Font,
	FontSize = Enum.FontSize.Size14,
	TextXAlignment = Enum.TextXAlignment.Left,
	TextColor = Styles.White,
	TextColorOver = Styles.WhiteOver,
	TextLockedColor = Color3_fromRGB(155,155,160),
	Height = 24,
	BorderColor = Color3_fromRGB(54,54,55),
	BackgroundColor = Styles.Black2,
	BackgroundColorAlternate = Color3_fromRGB(32, 32, 37),
	BackgroundColorMouseover = Color3_fromRGB(40, 40, 45),
	TitleMarginLeft = 15
}

local DropDown = {
	Font = Styles.Font,
	FontSize = Enum.FontSize.Size14,
	TextColor = Color3_fromRGB(255,255,260),
	TextColorOver = Row.TextColorOver,
	TextXAlignment = Enum.TextXAlignment.Left,
	Height = 20,
	BackColor = Styles.Black2,
	BackColorOver = Styles.Hover2,
	BorderColor = Color3_fromRGB(45,45,50),
	BorderSizePixel = 0,
	ArrowColor = Color3_fromRGB(80,80,83),
	ArrowColorOver = Styles.Hover
}

local BrickColors = {
	BoxSize = 13,
	BorderSizePixel = 0,
	BorderColor = Color3_fromRGB(53,53,55),
	FrameColor = Color3_fromRGB(53,53,55),
	Size = 20,
	Padding = 4,
	ColorsPerRow = 8,
	OuterBorder = 1,
	OuterBorderColor = Styles.Black
}

local currentRightClickMenu
local CurrentInsertObjectWindow
local CurrentFunctionCallerWindow

local RbxApi

function ClassCanCreate(IName)
	local success,err = pcall(function() Instance_new(IName) end)
	if err then
		return false
	else
		return true
	end
end

function GetClasses()
	if RbxApi == nil then return {} end
	local classTable = {}
	for i,v in pairs(RbxApi.Classes) do
		if ClassCanCreate(v.Name) then
			table.insert(classTable,v.Name)
		end
	end
	return classTable
end

local function sortAlphabetic(t, property)
	table.sort(t,
		function(x,y) return x[property] < y[property]
	end)
end

local function FunctionIsHidden(functionData)
	local tags = functionData["Tags"]
	if tags then
		for _,name in pairs(tags) do
			if name == "Deprecated"
				or name == "Hidden"
				or name == "ReadOnly"
				or name == "NotScriptable" then
				return true
			end
		end
	end
	return false
end

local function GetAllFunctions(className)
	local class = RbxApi.Classes[className]
	local functions = {}

	if not class then return functions end

	while class do
		if class.Name == "Instance" then break end
		for _,nextFunction in pairs(class.Members) do
			if nextFunction.MemberType == "Function" and not FunctionIsHidden(nextFunction) then
				table.insert(functions, nextFunction)
			end
		end
		class = RbxApi.Classes[class.Superclass]
	end

	sortAlphabetic(functions, "Name")

	return functions
end

function GetFunctions()
	if RbxApi == nil then return {} end
	local List = SelectionVar():Get()

	if #List == 0 then return end

	local MyObject = List[1]

	local functionTable = {}
	for i,v in pairs(GetAllFunctions(MyObject.ClassName)) do
		table.insert(functionTable,v)
	end
	return functionTable
end

function CreateInsertObjectMenu(choices, currentChoice, readOnly, onClick)
	local mouse = game:GetService("Players").LocalPlayer:GetMouse()
	local totalSize = explorerPanel.Parent.AbsoluteSize.y
	if #choices == 0 then return end

	table.sort(choices, function(a,b) return a < b end)

	local frame = Instance_new("Frame")
	frame.Name = "InsertObject"
	frame.Size = UDim2_new(0, 200, 1, 0)
	frame.BackgroundTransparency = 1
	frame.Active = true

	local menu = nil
	local arrow = nil
	local expanded = false
	local margin = DropDown.BorderSizePixel;

	--[[
	local button = Instance_new("TextButton")
	button.Font = Row.Font
	button.FontSize = Row.FontSize
	button.TextXAlignment = Row.TextXAlignment
	button.BackgroundTransparency = 1
	button.TextColor3 = Row.TextColor
	if readOnly then
		button.TextColor3 = Row.TextLockedColor
	end
	button.Text = currentChoice
	button.Size = UDim2_new(1, -2 * Styles.Margin, 1, 0)
	button.Position = UDim2_new(0, Styles.Margin, 0, 0)
	button.Parent = frame
	--]]

	local function hideMenu()
		expanded = false
		--showArrow(DropDown.ArrowColor)
		if frame then
			--frame:Destroy()
			CurrentInsertObjectWindow.Visible = false
		end
	end

	local function showMenu()
		expanded = true
		menu = Instance_new("ScrollingFrame")
		menu.Size = UDim2_new(0,200,1,0)
		menu.CanvasSize = UDim2_new(0, 200, 0, #choices * DropDown.Height)
		menu.Position = UDim2_new(0, margin, 0, 0)
		menu.BackgroundTransparency = 0
		menu.BackgroundColor3 = DropDown.BackColor
		menu.BorderColor3 = DropDown.BorderColor
		menu.BorderSizePixel = DropDown.BorderSizePixel
		menu.TopImage = "rbxasset://textures/blackBkg_square.png"
		menu.MidImage = "rbxasset://textures/blackBkg_square.png"
		menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
		menu.Active = true
		menu.ZIndex = 5
		menu.Parent = frame

		--local parentFrameHeight = script.Parent.List.Size.Y.Offset
		--local rowHeight = mouse.Y
		--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
		--	menu.Position = UDim2_new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
		--end

		local function choice(name)
			onClick(name)
			hideMenu()
		end

		for i,name in pairs(choices) do
			local option = CreateRightClickMenuItem(name, function()
				choice(name)
			end,1)
			option.Size = UDim2_new(1, 0, 0, 20)
			option.Position = UDim2_new(0, 0, 0, (i - 1) * DropDown.Height)
			option.ZIndex = menu.ZIndex
			option.Parent = menu
		end
	end

	showMenu()

	return frame
end

function CreateFunctionCallerMenu(choices, currentChoice, readOnly, onClick)
	local mouse = game:GetService("Players").LocalPlayer:GetMouse()
	local totalSize = explorerPanel.Parent.AbsoluteSize.y
	if #choices == 0 then return end

	table.sort(choices, function(a,b) return a.Name < b.Name end)

	local frame = Instance_new("Frame")
	frame.Name = "InsertObject"
	frame.Size = UDim2_new(0, 200, 1, 0)
	frame.BackgroundTransparency = 1
	frame.Active = true

	local menu = nil
	local arrow = nil
	local expanded = false
	local margin = DropDown.BorderSizePixel;

	local function hideMenu()
		expanded = false
		--showArrow(DropDown.ArrowColor)
		if frame then
			--frame:Destroy()
			CurrentInsertObjectWindow.Visible = false
		end
	end

	local function showMenu()
		expanded = true
		menu = Instance_new("ScrollingFrame")
		menu.Size = UDim2_new(0,300,1,0)
		menu.CanvasSize = UDim2_new(0, 300, 0, #choices * DropDown.Height)
		menu.Position = UDim2_new(0, margin, 0, 0)
		menu.BackgroundTransparency = 0
		menu.BackgroundColor3 = DropDown.BackColor
		menu.BorderColor3 = DropDown.BorderColor
		menu.BorderSizePixel = DropDown.BorderSizePixel
		menu.TopImage = "rbxasset://textures/blackBkg_square.png"
		menu.MidImage = "rbxasset://textures/blackBkg_square.png"
		menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
		menu.Active = true
		menu.ZIndex = 5
		menu.Parent = frame

		--local parentFrameHeight = script.Parent.List.Size.Y.Offset
		--local rowHeight = mouse.Y
		--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
		--	menu.Position = UDim2_new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
		--end

		local function GetParameters(functionData)
			local paraString = ""
			paraString = paraString.."("
			for i,v in pairs(functionData.Parameters) do
				paraString = paraString..v.Type.Name.." "..v.Name
				if i < #functionData.Parameters then
					paraString = paraString..", "
				end
			end
			paraString = paraString..")"
			return paraString
		end

		local function choice(name)
			onClick(name)
			hideMenu()
		end

		for i,name in pairs(choices) do
			local option = CreateRightClickMenuItem(name.ReturnType.Name.." "..name.Name..GetParameters(name), function()
				choice(name)
			end,2)
			option.Size = UDim2_new(1, 0, 0, 20)
			option.Position = UDim2_new(0, 0, 0, (i - 1) * DropDown.Height)
			option.ZIndex = menu.ZIndex
			option.Parent = menu
		end
	end


	showMenu()


	return frame
end

function CreateInsertObject()
	if not CurrentInsertObjectWindow then return end
	CurrentInsertObjectWindow.Visible = true
	if currentRightClickMenu and CurrentInsertObjectWindow.Visible then
		CurrentInsertObjectWindow.Position = UDim2_new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset,0,0)
	end
	if CurrentInsertObjectWindow.Visible then
		CurrentInsertObjectWindow.Parent = explorerPanel.Parent
	end
end

function CreateFunctionCaller(oh)
	if CurrentFunctionCallerWindow then
		CurrentFunctionCallerWindow:Destroy()
		CurrentFunctionCallerWindow = nil
	end
	CurrentFunctionCallerWindow = CreateFunctionCallerMenu(
		GetFunctions(),
		"",
		false,
		function(option)
			CurrentFunctionCallerWindow:Destroy()
			CurrentFunctionCallerWindow = nil
			local list = SelectionVar():Get()
			for i,v in pairs(list) do
				local rets = RemoteEvent:InvokeServer("CallFunction",v,option.Name)
				print(rets)
				pcall(function() print("Function", option.Name, "on", v, ":", unpack(rets)) end)
			end

			DestroyRightClick()
		end
	)
	if currentRightClickMenu and CurrentFunctionCallerWindow then
		CurrentFunctionCallerWindow.Position = UDim2_new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset*1.5,0,0)
	end
	if CurrentFunctionCallerWindow then
		CurrentFunctionCallerWindow.Parent = explorerPanel.Parent
	end
end

function CreateRightClickMenuItem(text, onClick, insObj)
	local button = Instance_new("TextButton")
	button.Font = DropDown.Font
	button.FontSize = DropDown.FontSize
	button.TextColor3 = DropDown.TextColor
	button.BackgroundColor3 = DropDown.BackColor
	button.AutoButtonColor = false
	button.BorderSizePixel = 0
	button.TextTransparency = 1
	button.Active = true

	if text then
		local label = Instance_new("TextLabel")
		label.Size = UDim2_new(1, 0, 1, 0)
		label.Font = DropDown.Font
		label.FontSize = Enum.FontSize.Size11
		label.TextColor3 = DropDown.TextColor
		label.TextXAlignment = DropDown.TextXAlignment
		label.BackgroundTransparency = 1
		label.BorderSizePixel = 0
		label.ZIndex = 5

		label.Text = text
		button.Text = text

		label.Parent = button


		if insObj == 2 then
			label.FontSize = Enum.FontSize.Size11
			label.Size = UDim2_new(1, -16, 1, 0)
			label.Position = UDim2_new(0, 16, 0, 0)
		else
			if insObj == 1 or ExplorerIndex[text] then
				if ExplorerIndex[text] then
					local newIcon = Icon(nil,ExplorerIndex[text] or 0)
					newIcon.Position = UDim2_new(0,2,0,2)
					newIcon.Size = UDim2_new(0,16,0,16)
					newIcon.IconMap.ZIndex = 5
					newIcon.Parent = button
				else
					local newIcon = ClassIcon(nil,ClassIndex[text] or 0)
					newIcon.Position = UDim2_new(0,2,0,2)
					newIcon.Size = UDim2_new(0,16,0,16)
					newIcon.IconMap.ZIndex = 5
					newIcon.Parent = button
				end
			end

			label.Size = UDim2_new(1, -32, 1, 0)
			label.Position = UDim2_new(0, 32, 0, 0)
		end


		button.MouseEnter:connect(function()
			button.TextColor3 = DropDown.TextColorOver
			button.BackgroundColor3 = DropDown.BackColorOver
			if not insObj and CurrentInsertObjectWindow then
				if CurrentInsertObjectWindow.Visible == false and button.Text == "Insert Object" then
					CreateInsertObject()
				elseif CurrentInsertObjectWindow.Visible and button.Text ~= "Insert Object" then
					CurrentInsertObjectWindow.Visible = false
				end
			end
			if not insObj then
				if CurrentFunctionCallerWindow and button.Text ~= "Call Function" then
					CurrentFunctionCallerWindow:Destroy()
					CurrentFunctionCallerWindow = nil
				elseif button.Text == "Call Function" then
					CreateFunctionCaller()
				end
			end
		end)
		button.MouseLeave:connect(function()
			button.TextColor3 = DropDown.TextColor
			button.BackgroundColor3 = DropDown.BackColor
		end)
		button.MouseButton1Click:connect(function()
			button.TextColor3 = DropDown.TextColor
			button.BackgroundColor3 = DropDown.BackColor
			onClick(text)
		end)
	else
		local sep = Instance_new("Frame", button)
		sep.Size = UDim2_new(1, -20, 0, 1)
		sep.Position = UDim2_new(0, 16, 0, 2)
		sep.BackgroundColor3 = DropDown.BorderColor
		sep.BorderSizePixel = 0
		sep.ZIndex = 5
	end

	return button
end

function CreateRightClickMenu(choices, currentChoice, readOnly, onClick)
	local mouse = game:GetService("Players").LocalPlayer:GetMouse()

	local frame = Instance_new("TextButton")
	frame.Name = "DropDown"
	frame.Size = UDim2_new(0, 200, 0, 0)
	frame.BackgroundTransparency = 1
	frame.AutoButtonColor = false
	frame.Active = false

	local menu = nil
	local arrow = nil
	local expanded = false
	local margin = DropDown.BorderSizePixel;

	local function hideMenu()
		expanded = false
		if frame then
			frame:Destroy()
			DestroyRightClick()
		end
	end

	local function showMenu()
		expanded = true
		menu = Instance_new("Frame")
		menu.Size = UDim2_new(0, 200, 0, 0)

		for i,name in pairs(choices) do
			if name then
				menu.Size = menu.Size + UDim2_new(0, 0, 0, 20)
			else
				menu.Size = menu.Size + UDim2_new(0, 0, 0, 7)
			end
		end

		frame.Size = menu.Size + UDim2_new(0, 0, 0, 6)

		menu.Position = UDim2_new(0, 0, 0, 0)
		menu.BackgroundTransparency = 0
		menu.BackgroundColor3 = DropDown.BackColor
		menu.BorderColor3 = DropDown.BorderColor
		menu.BorderSizePixel = DropDown.BorderSizePixel
		menu.Active = true
		menu.ZIndex = 5
		menu.Parent = frame

		local function choice(name)
			onClick(name)
			hideMenu()
		end

		local previous
		for i,name in pairs(choices) do
			local option = CreateRightClickMenuItem(name, function()
				choice(name)
			end)

			if name then
				option.Size = UDim2_new(1, 0, 0, 20)
			else
				option.Size = UDim2_new(1, 0, 0, 7)
			end

			if previous then
				option.Position = UDim2_new(0, 0, 0, previous.Position.Height.Offset + previous.Size.Height.Offset)
			end

			option.ZIndex = menu.ZIndex
			option.Parent = menu

			previous = option
		end
	end

	showMenu()

	return frame
end

function checkMouseInGui(gui)
	if gui == nil then return false end
	local plrMouse = game:GetService("Players").LocalPlayer:GetMouse()
	local guiPosition = gui.AbsolutePosition
	local guiSize = gui.AbsoluteSize

	if plrMouse.X >= guiPosition.x and plrMouse.X <= guiPosition.x + guiSize.x and plrMouse.Y >= guiPosition.y and plrMouse.Y <= guiPosition.y + guiSize.y then
		return true
	else
		return false
	end
end

local clipboard = {}
local function delete(o)
	o.Parent = nil
	RemoteEvent:InvokeServer("Delete", o)
end

local getTextWidth do
	local text = Create('TextLabel',{
		Name = "TextWidth";
		TextXAlignment = 'Left';
		TextYAlignment = 'Center';
		Font = FONT;
		FontSize = FONT_SIZE;
		Text = "";
		Position = UDim2_new(0,0,0,0);
		Size = UDim2_new(1,0,1,0);
		Visible = false;
		Parent = explorerPanel;
	})
	function getTextWidth(s)
		text.Text = s
		return text.TextBounds.x
	end
end

local nameScanned = false