local Y do local k="\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(k)local z do local Y=math.floor function z(k)return Y((k/14)%14),Y(k%14)end end function Y(Y,o)local g,c=z(o)local b=Vector2.new(256,256)local Z,j=2,1 local r=16 local D="\070\114\097\109\101"if type(Y)=="\115\116\114\105\110\103"then D=Y Y=nil end if not Y then Y=Create(D,{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=k;Size=UDim2.new(b.x/r,0,b.y/r,0)})})end Y.IconMap.Position=UDim2.new(-c-(Z*(c+1)+j)/r,0,-g-(Z*(g+1)+j)/r,0)return Y end end local function k()local Y=Instance.new("\070\114\097\109\101")Y.Size=UDim2.new(.5,-1,1,0)Y.BackgroundColor3=Row.BackgroundColor Y.BorderColor3=Row.BorderColor return Y end local function z(Y)local k=Instance.new("\084\101\120\116\076\097\098\101\108")k.Font=Row.Font k.FontSize=Row.FontSize k.TextXAlignment=Row.TextXAlignment k.BackgroundTransparency=1 if Y then k.TextColor3=Row.TextLockedColor else k.TextColor3=Row.TextColor end return k end local function o(Y,k)local z=Instance.new("\084\101\120\116\066\117\116\116\111\110")z.Font=Row.Font z.FontSize=Row.FontSize z.TextXAlignment=Row.TextXAlignment z.BackgroundTransparency=1 if Y then z.TextColor3=Row.TextLockedColor else z.TextColor3=Row.TextColor z.MouseButton1Click:connect(function()k()end)end return z end local function g(k)local z=Instance.new("\084\101\120\116\066\117\116\116\111\110")z.Font=Row.Font z.FontSize=Row.FontSize z.TextXAlignment=Row.TextXAlignment z.BackgroundTransparency=1 if k then z.TextColor3=Row.TextLockedColor else z.TextColor3=Row.TextColor end local o=Create(Y("\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=z})return z end local function c(Y)if Y then local k=z(Y)return k else local Y=Instance.new("\084\101\120\116\066\111\120")if not SettingsRemote:Invoke("\067\108\101\097\114\080\114\111\112\115")then Y.ClearTextOnFocus=false end Y.Font=Row.Font Y.FontSize=Row.FontSize Y.TextXAlignment=Row.TextXAlignment Y.BackgroundTransparency=1 Y.TextColor3=Row.TextColor return Y end end local function b(Y,k)local z=Instance.new("\084\101\120\116\066\117\116\116\111\110")z.Font=DropDown.Font z.FontSize=DropDown.FontSize z.TextColor3=DropDown.TextColor z.TextXAlignment=DropDown.TextXAlignment z.BackgroundColor3=DropDown.BackColor z.AutoButtonColor=false z.BorderSizePixel=0 z.Active=true z.Text=Y z.MouseEnter:connect(function()z.TextColor3=DropDown.TextColorOver z.BackgroundColor3=DropDown.BackColorOver end)z.MouseLeave:connect(function()z.TextColor3=DropDown.TextColor z.BackgroundColor3=DropDown.BackColor end)z.MouseButton1Click:connect(function()k(Y)end)return z end local function Z(Y,k,z,o)local g=Instance.new("\070\114\097\109\101")g.Name="\068\114\111\112\068\111\119\110"g.Size=UDim2.new(1,0,1,0)g.BackgroundTransparency=1 g.Active=true local c=nil local Z=nil local j=false local r=DropDown.BorderSizePixel local D=Instance.new("\084\101\120\116\066\117\116\116\111\110")D.Font=Row.Font D.FontSize=Row.FontSize D.TextXAlignment=Row.TextXAlignment D.BackgroundTransparency=1 D.TextColor3=Row.TextColor if z then D.TextColor3=Row.TextLockedColor end D.Text=k D.Size=UDim2.new(1,-2*Styles.Margin,1,0)D.Position=UDim2.new(0,Styles.Margin,0,0)D.Parent=g local function x(Y)if Z then Z:Destroy()end local k=Create("\070\114\097\109\101",{Name="\071\114\097\112\104\105\099";BorderSizePixel=0;BackgroundColor3=Y})local z=8.0 Z=ArrowGraphic(z,"\068\111\119\110",true,k)Z.Position=UDim2.new(1,-z*2,.5,-z/2)Z.Parent=g end local function p()j=false x(DropDown.ArrowColor)if c then c:Destroy()end end local function w()j=true c=Instance.new("\070\114\097\109\101")c.Size=UDim2.new(1,-2*r,0,#Y*DropDown.Height)c.Position=UDim2.new(0,r,0,Row.Height+r)c.BackgroundTransparency=0 c.BackgroundColor3=DropDown.BackColor c.BorderColor3=DropDown.BorderColor c.BorderSizePixel=DropDown.BorderSizePixel c.Active=true c.ZIndex=5 c.Parent=g local k=c.Parent.Parent.Parent.Parent.Size.Y.Offset local z=c.Parent.Parent.Parent.Position.Y.Offset if z+c.Size.Y.Offset>math.max(k,PropertiesFrame.AbsoluteSize.y)then c.Position=UDim2.new(0,r,0,-1*(#Y*DropDown.Height)-r)end local function Z(Y)o(Y)p()end for Y,k in pairs(Y)do local z=b(k,function()Z(k)end)z.Size=UDim2.new(1,0,0,16)z.Position=UDim2.new(0,0,0,(Y-1)*DropDown.Height)z.ZIndex=c.ZIndex z.Parent=c end end x(DropDown.ArrowColor)if not z then D.MouseEnter:connect(function()D.TextColor3=Row.TextColor x(DropDown.ArrowColorOver)end)D.MouseLeave:connect(function()D.TextColor3=Row.TextColor if not j then x(DropDown.ArrowColor)end end)D.MouseButton1Click:connect(function()if j then p()else w()end end)end return g,D end local function j(Y,k)local z=Instance.new("\070\114\097\109\101")z.Size=UDim2.new(1,0,1,0)z.BackgroundTransparency=1 local g=Instance.new("\070\114\097\109\101")g.BackgroundTransparency=0 g.SizeConstraint=Enum.SizeConstraint.RelativeXX g.Size=UDim2.new(1,-2*BrickColors.OuterBorder,1,-2*BrickColors.OuterBorder)g.BorderSizePixel=BrickColors.BorderSizePixel g.BorderColor3=BrickColors.BorderColor g.Position=UDim2.new(0,BrickColors.OuterBorder,0,BrickColors.OuterBorder+Row.Height)g.ZIndex=5 g.Visible=false g.BorderSizePixel=BrickColors.OuterBorder g.BorderColor3=BrickColors.OuterBorderColor g.Parent=z local function c()g.Visible=true end local function b()g.Visible=false end local function Z()g.Visible=not g.Visible end local j=Instance.new("\084\101\120\116\066\117\116\116\111\110",z)j.Position=UDim2.new(0,Styles.Margin,0,Styles.Margin)j.Size=UDim2.new(0,BrickColors.BoxSize,0,BrickColors.BoxSize)j.Text=""j.MouseButton1Click:connect(function()if not Y then Z()end end)if Y then j.AutoButtonColor=false end local r=Styles.Margin*2+BrickColors.BoxSize local D=o(Y,function()if not Y then Z()end end)D.Size=UDim2.new(1,-1*r-Styles.Margin,1,0)D.Position=UDim2.new(0,r,0,0)D.Parent=z local x=1/BrickColors.ColorsPerRow for Y=0,127,1 do local z=BrickColor.palette(Y)local o=z.Color local c=x*(Y%BrickColors.ColorsPerRow)local Z=x*math.floor(Y/BrickColors.ColorsPerRow)local j=Instance.new("\084\101\120\116\066\117\116\116\111\110")j.Text=""j.Size=UDim2.new(x,0,x,0)j.BackgroundColor3=o j.Position=UDim2.new(c,0,Z,0)j.ZIndex=g.ZIndex j.Parent=g j.MouseButton1Click:connect(function()b()k(z)end)end return z,D,j end local function r(Y,k)local z=Instance.new("\070\114\097\109\101")z.Size=UDim2.new(1,0,1,0)z.BackgroundTransparency=1 local o=Instance.new("\084\101\120\116\066\117\116\116\111\110",z)o.Position=UDim2.new(0,Styles.Margin,0,Styles.Margin)o.Size=UDim2.new(0,BrickColors.BoxSize,0,BrickColors.BoxSize)o.Text=""o.AutoButtonColor=false local g=Styles.Margin*2+BrickColors.BoxSize local b=c(Y)b.Size=UDim2.new(1,-1*g-Styles.Margin,1,0)b.Position=UDim2.new(0,g,0,0)b.Parent=z return z,b,o end function CreateCheckbox(Y,k,z)local o=Y local g=false local c=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")c.Size=UDim2.new(0,Sprite.Width,0,Sprite.Height)c.BackgroundTransparency=1 c.ClipsDescendants=true local b=Instance.new("\073\109\097\103\101\076\097\098\101\108",c)b.Name="\083\112\114\105\116\101\115\104\101\101\116\073\109\097\103\101\076\097\098\101\108"b.Size=UDim2.new(0,Spritesheet.Width,0,Spritesheet.Height)b.Image=Spritesheet.Image b.BackgroundTransparency=1 local function Z()local Y=GetCheckboxImageName(o,k,g)local z=SpritePosition(Y)b.Position=UDim2.new(0,-1*z[1],0,-1*z[2])end local function j(Y)o=Y Z()end if not k then c.MouseEnter:connect(function()g=true Z()end)c.MouseLeave:connect(function()g=false Z()end)c.MouseButton1Click:connect(function()z(o)end)end Z()return c,j 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


