local a do local f="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061"..MAP_ID;(game:GetService("\067\111\110\116\101\110\116\080\114\111\118\105\100\101\114")):Preload(f)local B do local a=math.floor function B(f)return a((f/14)%14),a(f%14)end end function a(a,l)local e,Q=B(l)local o=Vector2.new(256,256)local d,Z=2,1 local h=16 local q="\070\114\097\109\101"if type(a)=="\115\116\114\105\110\103"then q=a a=nil end if not a then a=Create(q,{Name="\073\099\111\110";BackgroundTransparency=1;ClipsDescendants=true,Create("\073\109\097\103\101\076\097\098\101\108",{Name="\073\099\111\110\077\097\112",Active=false;BackgroundTransparency=1;Image=f,Size=UDim2.new(o.x/h,0,o.y/h,0)})})end a.IconMap.Position=UDim2.new(-Q-(d*(Q+1)+Z)/h,0,-e-(d*(e+1)+Z)/h,0)return a end end local function f()local a=Instance.new("\070\114\097\109\101")a.Size=UDim2.new(.5,-1,1,0)a.BackgroundColor3=Row.BackgroundColor a.BorderColor3=Row.BorderColor return a end local function B(a)local f=Instance.new("\084\101\120\116\076\097\098\101\108")f.Font=Row.Font f.FontSize=Row.FontSize f.TextXAlignment=Row.TextXAlignment f.BackgroundTransparency=1 if a then f.TextColor3=Row.TextLockedColor else f.TextColor3=Row.TextColor end return f end local function l(a,f)local B=Instance.new("\084\101\120\116\066\117\116\116\111\110")B.Font=Row.Font B.FontSize=Row.FontSize B.TextXAlignment=Row.TextXAlignment B.BackgroundTransparency=1 if a then B.TextColor3=Row.TextLockedColor else B.TextColor3=Row.TextColor B.MouseButton1Click:connect(function()f()end)end return B end local function e(f)local B=Instance.new("\084\101\120\116\066\117\116\116\111\110")B.Font=Row.Font B.FontSize=Row.FontSize B.TextXAlignment=Row.TextXAlignment B.BackgroundTransparency=1 if f then B.TextColor3=Row.TextLockedColor else B.TextColor3=Row.TextColor end local l=Create(a("\073\109\097\103\101\066\117\116\116\111\110",177),{Name="\067\097\110\099\101\108";Visible=false,Position=UDim2.new(1,-20,0,0),Size=UDim2.new(0,20,0,20),Parent=B})return B end local function Q(a)if a then local f=B(a)return f else local a=Instance.new("\084\101\120\116\066\111\120")if not SettingsRemote:Invoke("\067\108\101\097\114\080\114\111\112\115")then a.ClearTextOnFocus=false end a.Font=Row.Font a.FontSize=Row.FontSize a.TextXAlignment=Row.TextXAlignment a.BackgroundTransparency=1 a.TextColor3=Row.TextColor return a end end local function o(a,f)local B=Instance.new("\084\101\120\116\066\117\116\116\111\110")B.Font=DropDown.Font B.FontSize=DropDown.FontSize B.TextColor3=DropDown.TextColor B.TextXAlignment=DropDown.TextXAlignment B.BackgroundColor3=DropDown.BackColor B.AutoButtonColor=false B.BorderSizePixel=0 B.Active=true B.Text=a B.MouseEnter:connect(function()B.TextColor3=DropDown.TextColorOver B.BackgroundColor3=DropDown.BackColorOver end)B.MouseLeave:connect(function()B.TextColor3=DropDown.TextColor B.BackgroundColor3=DropDown.BackColor end)B.MouseButton1Click:connect(function()f(a)end)return B end local function d(a,f,B,l)local e=Instance.new("\070\114\097\109\101")e.Name="\068\114\111\112\068\111\119\110"e.Size=UDim2.new(1,0,1,0)e.BackgroundTransparency=1 e.Active=true local Q=nil local d=nil local Z=false local h=DropDown.BorderSizePixel local q=Instance.new("\084\101\120\116\066\117\116\116\111\110")q.Font=Row.Font q.FontSize=Row.FontSize q.TextXAlignment=Row.TextXAlignment q.BackgroundTransparency=1 q.TextColor3=Row.TextColor if B then q.TextColor3=Row.TextLockedColor end q.Text=f q.Size=UDim2.new(1,-2*Styles.Margin,1,0)q.Position=UDim2.new(0,Styles.Margin,0,0)q.Parent=e local function N(a)if d then d:Destroy()end local f=Create("\070\114\097\109\101",{Name="\071\114\097\112\104\105\099",BorderSizePixel=0;BackgroundColor3=a})local B=8.0 d=ArrowGraphic(B,"\068\111\119\110",true,f)d.Position=UDim2.new(1,-B*2,.5,-B/2)d.Parent=e end local function u()Z=false N(DropDown.ArrowColor)if Q then Q:Destroy()end end local function n()Z=true Q=Instance.new("\070\114\097\109\101")Q.Size=UDim2.new(1,-2*h,0,#a*DropDown.Height)Q.Position=UDim2.new(0,h,0,Row.Height+h)Q.BackgroundTransparency=0 Q.BackgroundColor3=DropDown.BackColor Q.BorderColor3=DropDown.BorderColor Q.BorderSizePixel=DropDown.BorderSizePixel Q.Active=true Q.ZIndex=5 Q.Parent=e local f=Q.Parent.Parent.Parent.Parent.Size.Y.Offset local B=Q.Parent.Parent.Parent.Position.Y.Offset if B+Q.Size.Y.Offset>math.max(f,PropertiesFrame.AbsoluteSize.y)then Q.Position=UDim2.new(0,h,0,-1*(#a*DropDown.Height)-h)end local function d(a)l(a)u()end for a,f in pairs(a)do local B=o(f,function()d(f)end)B.Size=UDim2.new(1,0,0,16)B.Position=UDim2.new(0,0,0,(a-1)*DropDown.Height)B.ZIndex=Q.ZIndex B.Parent=Q end end N(DropDown.ArrowColor)if not B then q.MouseEnter:connect(function()q.TextColor3=Row.TextColor N(DropDown.ArrowColorOver)end)q.MouseLeave:connect(function()q.TextColor3=Row.TextColor if not Z then N(DropDown.ArrowColor)end end)q.MouseButton1Click:connect(function()if Z then u()else n()end end)end return e,q end local function Z(a,f)local B=Instance.new("\070\114\097\109\101")B.Size=UDim2.new(1,0,1,0)B.BackgroundTransparency=1 local e=Instance.new("\070\114\097\109\101")e.BackgroundTransparency=0 e.SizeConstraint=Enum.SizeConstraint.RelativeXX e.Size=UDim2.new(1,-2*BrickColors.OuterBorder,1,-2*BrickColors.OuterBorder)e.BorderSizePixel=BrickColors.BorderSizePixel e.BorderColor3=BrickColors.BorderColor e.Position=UDim2.new(0,BrickColors.OuterBorder,0,BrickColors.OuterBorder+Row.Height)e.ZIndex=5 e.Visible=false e.BorderSizePixel=BrickColors.OuterBorder e.BorderColor3=BrickColors.OuterBorderColor e.Parent=B local function Q()e.Visible=true end local function o()e.Visible=false end local function d()e.Visible=not e.Visible end local Z=Instance.new("\084\101\120\116\066\117\116\116\111\110",B)Z.Position=UDim2.new(0,Styles.Margin,0,Styles.Margin)Z.Size=UDim2.new(0,BrickColors.BoxSize,0,BrickColors.BoxSize)Z.Text=""Z.MouseButton1Click:connect(function()if not a then d()end end)if a then Z.AutoButtonColor=false end local h=Styles.Margin*2+BrickColors.BoxSize local q=l(a,function()if not a then d()end end)q.Size=UDim2.new(1,-1*h-Styles.Margin,1,0)q.Position=UDim2.new(0,h,0,0)q.Parent=B local N=1/BrickColors.ColorsPerRow for a=0,127,1 do local B=BrickColor.palette(a)local l=B.Color local Q=N*(a%BrickColors.ColorsPerRow)local d=N*math.floor(a/BrickColors.ColorsPerRow)local Z=Instance.new("\084\101\120\116\066\117\116\116\111\110")Z.Text=""Z.Size=UDim2.new(N,0,N,0)Z.BackgroundColor3=l Z.Position=UDim2.new(Q,0,d,0)Z.ZIndex=e.ZIndex Z.Parent=e Z.MouseButton1Click:connect(function()o()f(B)end)end return B,q,Z end local function h(a,f)local B=Instance.new("\070\114\097\109\101")B.Size=UDim2.new(1,0,1,0)B.BackgroundTransparency=1 local l=Instance.new("\084\101\120\116\066\117\116\116\111\110",B)l.Position=UDim2.new(0,Styles.Margin,0,Styles.Margin)l.Size=UDim2.new(0,BrickColors.BoxSize,0,BrickColors.BoxSize)l.Text=""l.AutoButtonColor=false local e=Styles.Margin*2+BrickColors.BoxSize local o=Q(a)o.Size=UDim2.new(1,-1*e-Styles.Margin,1,0)o.Position=UDim2.new(0,e,0,0)o.Parent=B return B,o,l end function CreateCheckbox(a,f,B)local l=a local e=false local Q=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")Q.Size=UDim2.new(0,Sprite.Width,0,Sprite.Height)Q.BackgroundTransparency=1 Q.ClipsDescendants=true local o=Instance.new("\073\109\097\103\101\076\097\098\101\108",Q)o.Name="\083\112\114\105\116\101\115\104\101\101\116\073\109\097\103\101\076\097\098\101\108"o.Size=UDim2.new(0,Spritesheet.Width,0,Spritesheet.Height)o.Image=Spritesheet.Image o.BackgroundTransparency=1 local function d()local a=GetCheckboxImageName(l,f,e)local B=SpritePosition(a)o.Position=UDim2.new(0,-1*B[1],0,-1*B[2])end local function Z(a)l=a d()end if not f then Q.MouseEnter:connect(function()e=true d()end)Q.MouseLeave:connect(function()e=false d()end)Q.MouseButton1Click:connect(function()B(l)end)end d()return Q,Z end

local Icon do
	local iconMap = 'http://www.roblox.com/asset/?id=' .. MAP_ID
	game:GetService('ContentProvider'):Preload(iconMap)
	local iconDehash do
		-- 14 x 14, 0-based input, 0-based output
		local f=math.floor
		function iconDehash(h)
			return f(h/14%14),f(h%14)
		end
	end

	function Icon(IconFrame,index)
		local row,col = iconDehash(index)
		local mapSize = Vector2.new(256,256)
		local pad,border = 2,1
		local iconSize = 16

		local class = 'Frame'
		if type(IconFrame) == 'string' then
			class = IconFrame
			IconFrame = nil
		end

		if not IconFrame then
			IconFrame = Create(class,{
				Name = "Icon";
				BackgroundTransparency = 1;
				ClipsDescendants = true;
				Create('ImageLabel',{
					Name = "IconMap";
					Active = false;
					BackgroundTransparency = 1;
					Image = iconMap;
					Size = UDim2.new(mapSize.x/iconSize,0,mapSize.y/iconSize,0);
				});
			})
		end

		IconFrame.IconMap.Position = UDim2.new(-col - (pad*(col+1) + border)/iconSize,0,-row - (pad*(row+1) + border)/iconSize,0)
		return IconFrame
	end
end

local function CreateCell()
	local tableCell = Instance.new("Frame")
	tableCell.Size = UDim2.new(0.5, -1, 1, 0)
	tableCell.BackgroundColor3 = Row.BackgroundColor
	tableCell.BorderColor3 = Row.BorderColor
	return tableCell
end
	
local function CreateLabel(readOnly)
	local label = Instance.new("TextLabel")
	label.Font = Row.Font
	label.FontSize = Row.FontSize
	label.TextXAlignment = Row.TextXAlignment
	label.BackgroundTransparency = 1
	
	if readOnly then
		label.TextColor3 = Row.TextLockedColor
	else
		label.TextColor3 = Row.TextColor
	end
	return label
end

local function CreateTextButton(readOnly, onClick)
	local button = Instance.new("TextButton")
	button.Font = Row.Font
	button.FontSize = Row.FontSize
	button.TextXAlignment = Row.TextXAlignment
	button.BackgroundTransparency = 1
	if readOnly then
		button.TextColor3 = Row.TextLockedColor
	else
		button.TextColor3 = Row.TextColor
		button.MouseButton1Click:connect(function()
			onClick()
		end)
	end
	return button
end

local function CreateObject(readOnly)
	local button = Instance.new("TextButton")
	button.Font = Row.Font
	button.FontSize = Row.FontSize
	button.TextXAlignment = Row.TextXAlignment
	button.BackgroundTransparency = 1
	if readOnly then
		button.TextColor3 = Row.TextLockedColor
	else
		button.TextColor3 = Row.TextColor
	end
	local cancel = Create(Icon('ImageButton',177),{
		Name = "Cancel";
		Visible = false;
		Position = UDim2.new(1,-20,0,0);
		Size = UDim2.new(0,20,0,20);
		Parent = button;
	})
	return button
end

local function CreateTextBox(readOnly)
	if readOnly then
		local box = CreateLabel(readOnly)
		return box
	else
		local box = Instance.new("TextBox")
		if not SettingsRemote:Invoke("ClearProps") then
			box.ClearTextOnFocus = false
		end
		box.Font = Row.Font
		box.FontSize = Row.FontSize
		box.TextXAlignment = Row.TextXAlignment
		box.BackgroundTransparency = 1
		box.TextColor3 = Row.TextColor
		return box
	end
end

local function CreateDropDownItem(text, onClick)
	local button = Instance.new("TextButton")
	button.Font = DropDown.Font
	button.FontSize = DropDown.FontSize
	button.TextColor3 = DropDown.TextColor
	button.TextXAlignment = DropDown.TextXAlignment
	button.BackgroundColor3 = DropDown.BackColor
	button.AutoButtonColor = false
	button.BorderSizePixel = 0
	button.Active = true
	button.Text = text
	
	button.MouseEnter:connect(function()
		button.TextColor3 = DropDown.TextColorOver
		button.BackgroundColor3 = DropDown.BackColorOver
	end)
	button.MouseLeave:connect(function()
		button.TextColor3 = DropDown.TextColor
		button.BackgroundColor3 = DropDown.BackColor
	end)
	button.MouseButton1Click:connect(function()
		onClick(text)
	end)	
	return button
end

local function CreateDropDown(choices, currentChoice, readOnly, onClick)
	local frame = Instance.new("Frame")	
	frame.Name = "DropDown"
	frame.Size = UDim2.new(1, 0, 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 showArrow(color)
		if arrow then arrow:Destroy() end
		
		local graphicTemplate = Create('Frame',{
			Name="Graphic";
			BorderSizePixel = 0;
			BackgroundColor3 = color;
		})
		local graphicSize = 16/2
		
		arrow = ArrowGraphic(graphicSize,'Down',true,graphicTemplate)
		arrow.Position = UDim2.new(1,-graphicSize * 2,0.5,-graphicSize/2)
		arrow.Parent = frame
	end
	
	local function hideMenu()
		expanded = false
		showArrow(DropDown.ArrowColor)
		if menu then menu:Destroy() end
	end
	
	local function showMenu()
		expanded = true
		menu = Instance.new("Frame")
		menu.Size = UDim2.new(1, -2 * margin, 0, #choices * DropDown.Height)
		menu.Position = UDim2.new(0, margin, 0, Row.Height + margin)
		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 parentFrameHeight = menu.Parent.Parent.Parent.Parent.Size.Y.Offset
		local rowHeight = menu.Parent.Parent.Parent.Position.Y.Offset
		if (rowHeight + menu.Size.Y.Offset) > math.max(parentFrameHeight,PropertiesFrame.AbsoluteSize.y) 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 = CreateDropDownItem(name, function()
				choice(name)
			end)
			option.Size = UDim2.new(1, 0, 0, 16)
			option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
			option.ZIndex = menu.ZIndex
			option.Parent = menu
		end
	end
	
	showArrow(DropDown.ArrowColor)
	
	if not readOnly then
		
		button.MouseEnter:connect(function()
			button.TextColor3 = Row.TextColor
			showArrow(DropDown.ArrowColorOver)
		end)
		button.MouseLeave:connect(function()
			button.TextColor3 = Row.TextColor
			if not expanded then
				showArrow(DropDown.ArrowColor)
			end
		end)
		button.MouseButton1Click:connect(function()
			if expanded then
				hideMenu()
			else
				showMenu()
			end
		end)
	end
	
	return frame,button
end

local function CreateBrickColor(readOnly, onClick)
	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(1,0,1,0)
	frame.BackgroundTransparency = 1
	
	local colorPalette = Instance.new("Frame")
	colorPalette.BackgroundTransparency = 0
	colorPalette.SizeConstraint = Enum.SizeConstraint.RelativeXX
	colorPalette.Size = UDim2.new(1, -2 * BrickColors.OuterBorder, 1, -2 * BrickColors.OuterBorder)
	colorPalette.BorderSizePixel = BrickColors.BorderSizePixel
	colorPalette.BorderColor3 = BrickColors.BorderColor
	colorPalette.Position = UDim2.new(0, BrickColors.OuterBorder, 0, BrickColors.OuterBorder + Row.Height)
	colorPalette.ZIndex = 5
	colorPalette.Visible = false
	colorPalette.BorderSizePixel = BrickColors.OuterBorder
	colorPalette.BorderColor3 = BrickColors.OuterBorderColor
	colorPalette.Parent = frame
	
	local function show()
		colorPalette.Visible = true
	end
	
	local function hide()
		colorPalette.Visible = false
	end
	
	local function toggle()
		colorPalette.Visible = not colorPalette.Visible
	end
	
	local colorBox = Instance.new("TextButton", frame)
	colorBox.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)
	colorBox.Size = UDim2.new(0, BrickColors.BoxSize, 0, BrickColors.BoxSize)
	colorBox.Text = ""
	colorBox.MouseButton1Click:connect(function()
		if not readOnly then
			toggle()
		end
	end)
	
	if readOnly then
		colorBox.AutoButtonColor = false
	end
	
	local spacingBefore = (Styles.Margin * 2) + BrickColors.BoxSize
	
	local propertyLabel = CreateTextButton(readOnly, function()
		if not readOnly then
			toggle()
		end
	end)
	propertyLabel.Size = UDim2.new(1, (-1 * spacingBefore) - Styles.Margin, 1, 0)
	propertyLabel.Position = UDim2.new(0, spacingBefore, 0, 0)
	propertyLabel.Parent = frame
	
	local size = (1 / BrickColors.ColorsPerRow)
	
	for index = 0, 127 do
		local brickColor = BrickColor.palette(index)
		local color3 = brickColor.Color
		
		local x = size * (index % BrickColors.ColorsPerRow)
		local y = size * math.floor(index / BrickColors.ColorsPerRow)
	
		local brickColorBox = Instance.new("TextButton")
		brickColorBox.Text = ""
		brickColorBox.Size = UDim2.new(size,0,size,0)
		brickColorBox.BackgroundColor3 = color3
		brickColorBox.Position = UDim2.new(x, 0, y, 0)
		brickColorBox.ZIndex = colorPalette.ZIndex
		brickColorBox.Parent = colorPalette
	
		brickColorBox.MouseButton1Click:connect(function()
			hide()
			onClick(brickColor)
		end)
	end
	
	return frame,propertyLabel,colorBox
end

local function CreateColor3Control(readOnly, onClick)
	local frame = Instance.new("Frame")
	frame.Size = UDim2.new(1,0,1,0)
	frame.BackgroundTransparency = 1
	
	local colorBox = Instance.new("TextButton", frame)
	colorBox.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)
	colorBox.Size = UDim2.new(0, BrickColors.BoxSize, 0, BrickColors.BoxSize)
	colorBox.Text = ""
	colorBox.AutoButtonColor = false
	
	local spacingBefore = (Styles.Margin * 2) + BrickColors.BoxSize
	local box = CreateTextBox(readOnly)
	box.Size = UDim2.new(1, (-1 * spacingBefore) - Styles.Margin, 1, 0)
	box.Position = UDim2.new(0, spacingBefore, 0, 0)
	box.Parent = frame
	
	return frame,box,colorBox
end

function CreateCheckbox(value, readOnly, onClick)
	local checked = value
	local mouseover = false

	local checkboxFrame = Instance.new("ImageButton")
	checkboxFrame.Size = UDim2.new(0, Sprite.Width, 0, Sprite.Height)
	checkboxFrame.BackgroundTransparency = 1
	checkboxFrame.ClipsDescendants = true
	--checkboxFrame.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)

	local spritesheetImage = Instance.new("ImageLabel", checkboxFrame)
	spritesheetImage.Name = "SpritesheetImageLabel"
	spritesheetImage.Size = UDim2.new(0, Spritesheet.Width, 0, Spritesheet.Height)
	spritesheetImage.Image = Spritesheet.Image
	spritesheetImage.BackgroundTransparency = 1
	
	local function updateSprite()
		local spriteName = GetCheckboxImageName(checked, readOnly, mouseover)
		local spritePosition = SpritePosition(spriteName)
		spritesheetImage.Position = UDim2.new(0, -1 * spritePosition[1], 0, -1 * spritePosition[2])
	end
	
	local function setValue(val)
		checked = val
		updateSprite()
	end

	if not readOnly then
		checkboxFrame.MouseEnter:connect(function() mouseover = true updateSprite() end)
		checkboxFrame.MouseLeave:connect(function() mouseover = false updateSprite() end)
		checkboxFrame.MouseButton1Click:connect(function()
			onClick(checked)
		end)
	end
	
	updateSprite()
	
	return checkboxFrame, setValue
end


