local m=script.Parent.Parent return function(Y)local n=require(m.Bundles)local k=n.data local h=n.themeSystem local P=n.icons local A=n.flags local L=n.services local u=L.UserInputService local K=L.RunService local X=n.Fusion local V=X.New local S=X.Children local s=X.Value local g=X.Observer local p=X.OnEvent local c=X.Computed local O=X.Ref local l=require(m.utilities)local o=l.get local G=l.animate local b=l.typecheck local J=l.customFont local N=require(m.simpleElements)local t=N.UIListLayout local j=N.UIPadding local a=N.UICorner local F=Enum.SortOrder local U=Enum.FillDirection local E=Enum.HorizontalAlignment local v=Enum.VerticalAlignment local z,B=b(Y,{Name="";DisabledText="",IsEnabled=false;Visible=false;Callback=function() end,FLAG="";Default=0,Min=0,Max=0,DisplayAsPercent=false,DecimalPlace=0;IgnoreConfig=true},{Y.DisabledText and""or"\068\105\115\097\098\108\101\100\084\101\120\116";Y.IsEnabled and""or"\073\115\069\110\097\098\108\101\100",Y.Visible and""or"\086\105\115\105\098\108\101",Y.FLAG and""or"\070\076\065\071";Y.Default and""or"\068\101\102\097\117\108\116";Y.Min and""or"\077\105\110";Y.Max and""or"\077\097\120",Y.DisplayAsPercent and""or"\068\105\115\112\108\097\121\065\115\080\101\114\099\101\110\116",Y.DecimalPlace and""or"\068\101\099\105\109\097\108\080\108\097\099\101",Y.IgnoreConfig and""or"\073\103\110\111\114\101\067\111\110\102\105\103"})assert(z,table.concat(B,"\n"))local e=k.find("\115\101\108\101\099\116\101\100\084\097\098")local d=k.find("\117\115\101\067\111\110\102\105\103")local R=k.find("\115\101\097\114\099\104\084\101\120\116")local Z=k.add(Y)local M=Y.Parent local C=Y.Name local I=Y.DisabledText or s("\067\111\109\112\111\110\101\110\116 \068\105\115\097\098\108\101\100")local i=Y.IsEnabled or s(true)local H=Y.Visible or s(true)local Q=Y.Callback local f=Y.Max local D=Y.Min local T=Y.DisplayAsPercent or s(false)local r=Y.DecimalPlace or s(0)local w=Y.IgnoreConfig or s(false)local W=o(Y.Default)and s(math.clamp(o(Y.Default),o(D),o(f)))if not o(W)then W=s(o(D))end local y=(Y.FLAG and o(Y.FLAG)~="")and o(Y.FLAG)or Z.uid local x=A.register(y,{percentageOf=s(o(D))},"\115\108\105\100\101\114",y==Z.uid)x.user.Value=o(x.status.percentageOf)local q=s(o(e.string)==(o(Z.tab)).uid);(g(e.string)):onChange(function()q:set(o(e.string)==(o(Z.tab)).uid)end)local mv=G(function()return o(q)and 0 or 1 end,40,1)local function Yv(m,Y,n,k,h)return(1-(m-Y)/(n-Y))*k+((m-Y)/(n-Y))*h end local function nv(m)if o(r)==0 then return math.floor(m)end return tonumber(string.format("\037\046"..(o(r).."\102"),m))end local kv=s(0);(g(x.status.percentageOf)):onChange(function()local m=o(x.status.percentageOf)if m>o(f)or m<o(D)then x.status.percentageOf:set(math.clamp(m,o(D),o(f)))return end kv:set(Yv(o(x.status.percentageOf),o(D),o(f),0,1))if not o(i)then return end task.spawn(o(Q),o(x.status.percentageOf))end)local hv=s()local Pv=s(10)local Av=s()local Lv=s(false)u.InputEnded:Connect(function(m)if(m.UserInputType==Enum.UserInputType.MouseButton1 or m.UserInputType==Enum.UserInputType.Touch)and o(Lv)then Lv:set(false)end end);(V("\070\114\097\109\101"))({Parent=M;Visible=c(function()if o(R.string)~=""and not string.find((o(C)):lower(),(o(R.string)):lower())or not o(H)then return false end return true end),Size=UDim2.new(1,0,0,36),BackgroundColor3=h.background2,BackgroundTransparency=G(function()if o(q)then return 0 end return 1 end,40,1),[S]={a(6);(V("\070\114\097\109\101"))({ZIndex=2;Visible=c(function()if not o(i)then return true end return false end);BackgroundTransparency=G(function()return o(q)and.2 or 1 end,40,1);BackgroundColor3=h.disabledBackground,Size=UDim2.fromScale(1,1);[S]={a(6),(V("\073\109\097\103\101\076\097\098\101\108"))({Size=UDim2.fromOffset(24,24);AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,5,.5,0);BackgroundTransparency=1;Image=P.lock;ImageColor3=h.disabledText;ImageTransparency=mv});(V("\084\101\120\116\076\097\098\101\108"))({FontFace=J("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold),BackgroundTransparency=1;Size=UDim2.new(1,-24,0,18);TextColor3=h.disabledText,TextTransparency=mv,TextScaled=true;AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,29,.5,0);Text=c(function()return o(I)end),TextXAlignment=Enum.TextXAlignment.Left;RichText=true,[S]={j(0,5)}})}});(V("\070\114\097\109\101"))({BackgroundTransparency=1,Size=UDim2.fromScale(1,1),[S]={t(F.LayoutOrder,U.Horizontal,E.Left,v.Center,UDim.new(0,6)),j(0,8),(V("\084\101\120\116\076\097\098\101\108"))({FontFace=J("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold);Size=UDim2.new(.5,-6,0,18);BackgroundTransparency=1,TextColor3=h.text;TextTransparency=mv;TextScaled=true;AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,0,.5,0),Text=C,TextXAlignment=Enum.TextXAlignment.Left;RichText=true});(V("\070\114\097\109\101"))({Size=UDim2.new(.5,0,1,0),AnchorPoint=Vector2.new(1,.5);Position=UDim2.new(1,0,.5,0);BackgroundTransparency=1,[S]={t(F.LayoutOrder,U.Horizontal,E.Left,v.Center,UDim.new(0,10));(V("\070\114\097\109\101"))({Size=UDim2.new(.2,-5,1,0);BackgroundTransparency=1,[S]={a(4);t(F.LayoutOrder,U.Vertical,E.Right,v.Center,UDim.new(0,1)),(V("\084\101\120\116\066\111\120"))({FontFace=J("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold);Size=UDim2.new(0,0,0,14),BackgroundTransparency=1;TextColor3=h.text2;TextTransparency=mv;TextScaled=true;ClearTextOnFocus=true;AnchorPoint=Vector2.new(1,.5),Position=UDim2.new(1,0,.5,0);Text=c(function()if o(T)then return tostring(nv(o(kv)*100)).."\037"end return o(x.status.percentageOf)or""end);TextXAlignment=Enum.TextXAlignment.Right;RichText=true,AutomaticSize=Enum.AutomaticSize.X;[p("\067\104\097\110\103\101\100")]=function(m)local Y=o(Av)if m=="\065\098\115\111\108\117\116\101\083\105\122\101"and(Y and Y.AbsoluteSize)then Pv:set(Y.AbsoluteSize.X)end end,[p("\070\111\099\117\115\076\111\115\116")]=function()local m=o(Av)if tonumber(m.Text)then x.status.percentageOf:set(math.clamp(tonumber(m.Text),o(D),o(f)))else if o(T)then m.Text=tostring(nv(o(kv)*100)).."\037"end m.Text=o(x.status.percentageOf)end end;[O]=Av,[S]={j(0,5,0,5)}}),(V("\070\114\097\109\101"))({BackgroundColor3=h.text2;BackgroundTransparency=G(function()if o(q)then return.5 end return 1 end,40,1);Size=G(function()return UDim2.fromOffset(o(Pv),2)end,40,1);[S]={a(0,1)}})}});(V("\084\101\120\116\066\117\116\116\111\110"))({Interactable=c(function()if not o(i)then return false end return o(q)end);Size=UDim2.new(.8,-5,.5,0);BackgroundTransparency=1,[p("\077\111\117\115\101\066\117\116\116\111\110\049\068\111\119\110")]=function()Lv:set(true)end,[p("\084\111\117\099\104\076\111\110\103\080\114\101\115\115")]=function()Lv:set(true)end;[p("\073\110\112\117\116\066\101\103\097\110")]=function(m)if m.UserInputType==Enum.UserInputType.MouseButton1 or m.UserInputType==Enum.UserInputType.Touch and o(hv)then local m=(u:GetMouseLocation()).X local Y=(o(hv)).Size.X.Offset local n=m-((o(hv)).AbsolutePosition.X+Y)while o(Lv)and task.wait()do local k=(u:GetMouseLocation()).X local h=math.clamp((Y+(k-m))+n,0,(o(hv)).AbsoluteSize.X)x.status.percentageOf:set(nv(Yv(h,0,(o(hv)).AbsoluteSize.X,o(D),o(f))))K.RenderStepped:Wait()end end end;[O]=hv,[S]={j(0,6),(V("\070\114\097\109\101"))({AnchorPoint=Vector2.new(0,.5);Position=UDim2.fromScale(0,.5);Size=UDim2.new(1,0,0,4),BackgroundColor3=h.background,BackgroundTransparency=mv;[S]={a(0,1)}}),(V("\070\114\097\109\101"))({AnchorPoint=Vector2.new(0,.5);Position=UDim2.fromScale(0,.5),BackgroundColor3=h.text,BackgroundTransparency=mv;Size=G(function()return UDim2.new(o(kv),0,0,4)end,40,1);[S]={a(0,1),(V("\073\109\097\103\101\076\097\098\101\108"))({Image=P.circle;BackgroundTransparency=1,ImageColor3=h.selectedTab,ImageTransparency=mv,Size=UDim2.fromOffset(18,18),Position=UDim2.new(1,0,.5,0),AnchorPoint=Vector2.new(.5,.5);[S]={(V("\070\114\097\109\101"))({Position=UDim2.new(.5,0,.5,0);AnchorPoint=Vector2.new(.5,.5),Size=UDim2.fromOffset(2,8);BackgroundColor3=h.text;BackgroundTransparency=G(function()if o(q)then return.8 end return 1 end,40,1)})}})}})}})}})}})}})if o(d.boolean)and not o(w)then x.file:Connect(function(m)local Y=true if m~=nil then x.status.percentageOf:set(math.clamp(m,o(D),o(f)))Y=false end if Y then x.status.percentageOf:set(o(W))end end)if x.private then x.status.percentageOf:set(o(W))end else x.status.percentageOf:set(o(W))end if x.preregistered and(x.preregisteredValue and typeof(x.preregisteredValue)=="\110\117\109\098\101\114")then x.status.percentageOf:set(math.clamp(x.preregisteredValue,o(D),o(f)))end local uv={}function uv.SetName(Y,m)local n,k=b({SetName=m},{SetName=""})assert(n,table.concat(k,"\n"))C:set(m)end function uv.SetValue(Y,m)local n,k=b({SetValue=m},{SetValue=0})assert(n,table.concat(k,"\n"))x.status.percentageOf:set(math.clamp(m,o(D),o(f)))end function uv.Enable(m)i:set(true)end function uv.Disable(m)i:set(false)end function uv.Visible(m)H:set(true)end function uv.Invisible(m)H:set(false)end return uv end
local darius = script.Parent.Parent

return function(property)
	local Bundles = require(darius.Bundles)
	local data = Bundles.data
	local theme = Bundles.themeSystem
	local icons = Bundles.icons
	local flagCreator = Bundles.flags
	local services = Bundles.services
		local UserInputService = services.UserInputService
		local RunService = services.RunService
	local Fusion = Bundles.Fusion
		local new = Fusion.New
		local children = Fusion.Children
		local value = Fusion.Value
		local observe = Fusion.Observer
		local onevent = Fusion.OnEvent
		local computed = Fusion.Computed
		local ref = Fusion.Ref

	local utilities = require(darius.utilities)
	local get = utilities.get
	local animate = utilities.animate
	local typecheck = utilities.typecheck
	local customFont = utilities.customFont

	local simpleElements = require(darius.simpleElements)
	local UIListLayout = simpleElements.UIListLayout
	local UIPadding = simpleElements.UIPadding
	local UICorner = simpleElements.UICorner
	local SO = Enum.SortOrder
	local FD = Enum.FillDirection
	local HA = Enum.HorizontalAlignment
	local VA = Enum.VerticalAlignment

	-- Typecheck

	local didPass, failedItems = typecheck(property,{
		Name = "",
		DisabledText = "",
		IsEnabled = false,
		Visible = false,
		Callback = function()end,

        FLAG = "",
		Default = 0,
		Min = 0,
        Max = 0,
		DisplayAsPercent = false,
		DecimalPlace = 0,
		IgnoreConfig = true
	},{
		property.DisabledText and "" or "DisabledText",
		property.IsEnabled and "" or "IsEnabled",
		property.Visible and "" or "Visible",

		property.FLAG and "" or "FLAG",
		property.Default and "" or "Default",
		property.Min and "" or "Min",
		property.Max and "" or "Max",
		property.DisplayAsPercent and "" or "DisplayAsPercent",
		property.DecimalPlace and "" or "DecimalPlace",
		property.IgnoreConfig and "" or "IgnoreConfig"
	})
	assert(didPass, table.concat(failedItems, "\n"))

	-- Data

	local selectedTab = data.find("selectedTab")
	local useConfig = data.find("useConfig")
	local searchText = data.find("searchText")
	local slider = data.add(property)

	-- Properties

	local _parent = property.Parent
	local name = property.Name
	local disabledText = property.DisabledText or value("Component Disabled")
	local isEnabled = property.IsEnabled or value(true)
	local visible = property.Visible or value(true)
	local callback = property.Callback

	local max = property.Max
	local min = property.Min
	local displayAsPercent = property.DisplayAsPercent or value(false)
	local roundTo = property.DecimalPlace or value(0)
	local ignoreConfig = property.IgnoreConfig or value(false)
	local default = get(property.Default) and value(math.clamp(get(property.Default), get(min), get(max)))
	if not get(default) then
		default = value(get(min))
	end

	local flag = (property.FLAG and get(property.FLAG) ~= "") and get(property.FLAG) or slider.uid
	local _flag = flagCreator.register(flag, {
		percentageOf = value(get(min))
	},"slider", flag == slider.uid)
	_flag.user.Value = get(_flag.status.percentageOf)

	-- Variables

	local isSelected = value(get(selectedTab.string) == get(slider.tab).uid)
	observe(selectedTab.string):onChange(function()
		isSelected:set(get(selectedTab.string) == get(slider.tab).uid)
	end)
	local selectedAnimation = animate(function()
		return get(isSelected) and 0 or 1
	end, 40, 1)
	local function mapValue(Value, MinA, MaxA, MinB, MaxB)
		return (1 - ((Value - MinA) / (MaxA - MinA))) * MinB + ((Value - MinA) / (MaxA - MinA)) * MaxB
	end
	local function round(Value)
		if get(roundTo) == 0 then
			return math.floor(Value)
		end
		return tonumber(string.format('%.' .. get(roundTo) .. 'f', Value))
	end
	local percentage = value(0)

	observe(_flag.status.percentageOf):onChange(function()
		local _percentageOf = get(_flag.status.percentageOf)
		if _percentageOf > get(max) or _percentageOf < get(min) then
			_flag.status.percentageOf:set(math.clamp(_percentageOf, get(min), get(max)))
			return
		end
		percentage:set(mapValue(get(_flag.status.percentageOf), get(min), get(max), 0, 1))
		if not get(isEnabled) then
			return
		end
		task.spawn(get(callback), get(_flag.status.percentageOf))
	end)
	local textbuttonRef = value()
	local textboxX = value(10)
	local textBoxRef = value()
	local button1Down = value(false)
	UserInputService.InputEnded:Connect(function(input)
		if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) and get(button1Down) then
			button1Down:set(false)
		end
	end)

	-- Slider

	new "Frame" {
		Parent = _parent,
		Visible = computed(function()
			if get(searchText.string) ~= "" and not string.find(get(name):lower(), get(searchText.string):lower()) or not get(visible) then
				return false
			end
			return true
		end),
		Size = UDim2.new(1,0,0,36),
		BackgroundColor3 = theme.background2,
		BackgroundTransparency = animate(function()
			if get(isSelected) then
				return 0
			end
			return 1
		end,40,1),

		[children] = {
			UICorner(6),
			new "Frame" { -- Disabled Frame
				ZIndex = 2,
				Visible = computed(function()
					if not get(isEnabled)  then
						return true
					end
					return false
				end),
				BackgroundTransparency = animate(function()
					return get(isSelected) and 0.2 or 1
				end,40,1),
				BackgroundColor3 = theme.disabledBackground,
				Size = UDim2.fromScale(1,1),

				[children] = {
					UICorner(6),
					new "ImageLabel" { -- Icon
						Size = UDim2.fromOffset(24,24),
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,5,0.5,0),
						BackgroundTransparency = 1,
						Image = icons.lock,
						ImageColor3 = theme.disabledText,
						ImageTransparency = selectedAnimation,
					},
					new "TextLabel" {
						FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
						BackgroundTransparency = 1,
						Size = UDim2.new(1,-24,0,18),
						TextColor3 = theme.disabledText,
						TextTransparency = selectedAnimation,
						TextScaled = true,
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,29,0.5,0),
						Text = computed(function()
							return get(disabledText)
						end),
						TextXAlignment = Enum.TextXAlignment.Left,
						RichText = true,

						[children] = {
							UIPadding(0,5)
						}
					}
				}
			},
			new "Frame" {
				BackgroundTransparency = 1,
				Size = UDim2.fromScale(1,1),

				[children] = {
					UIListLayout(SO.LayoutOrder,FD.Horizontal,HA.Left,VA.Center,UDim.new(0,6)),
					UIPadding(0,8),
					new "TextLabel" {
						FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
						Size = UDim2.new(0.5,-6,0,18),
						BackgroundTransparency = 1,
						TextColor3 = theme.text,
						TextTransparency = selectedAnimation,
						TextScaled = true,
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,0,0.5,0),
						Text = name,
						TextXAlignment = Enum.TextXAlignment.Left,
						RichText = true
					},
					new "Frame" {
						Size = UDim2.new(0.5,0,1,0),
						AnchorPoint = Vector2.new(1,0.5),
						Position = UDim2.new(1,0,0.5,0),
						BackgroundTransparency = 1,

						[children] = {
							UIListLayout(SO.LayoutOrder,FD.Horizontal,HA.Left,VA.Center, UDim.new(0,10)),
							new "Frame" {
								Size = UDim2.new(0.2,-5,1,0),
								BackgroundTransparency = 1,

								[children] = {
									UICorner(4),
									UIListLayout(SO.LayoutOrder,FD.Vertical,HA.Right,VA.Center,UDim.new(0,1)),
									new "TextBox" {
										FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
										Size = UDim2.new(0,0,0,14),
										BackgroundTransparency = 1,
										TextColor3 = theme.text2,
										TextTransparency = selectedAnimation,
										TextScaled = true,
										ClearTextOnFocus = true,
										AnchorPoint = Vector2.new(1,0.5),
										Position = UDim2.new(1,0,0.5,0),
										Text = computed(function()
											if get(displayAsPercent) then
												return tostring(round(get(percentage) * 100)).."%"
											end
											return get(_flag.status.percentageOf) or ""
										end),
										TextXAlignment = Enum.TextXAlignment.Right,
										RichText = true,
										AutomaticSize = Enum.AutomaticSize.X,

										[onevent "Changed"] = function(changedProperty)
											local textbox = get(textBoxRef)
											if changedProperty == "AbsoluteSize" and textbox and textbox.AbsoluteSize then
												textboxX:set(textbox.AbsoluteSize.X)
											end
										end,

										[onevent "FocusLost"] = function()
											local textbox = get(textBoxRef)
											if tonumber(textbox.Text) then
												_flag.status.percentageOf:set(math.clamp(tonumber(textbox.Text), get(min), get(max)))
											else
												if get(displayAsPercent) then
													textbox.Text = tostring(round(get(percentage) * 100)).."%"
												end
												textbox.Text = get(_flag.status.percentageOf)
											end
										end,

										[ref] = textBoxRef,

										[children] = {
											UIPadding(0,5,0,5)
										}
									},
									new "Frame"{
										BackgroundColor3 = theme.text2,
										BackgroundTransparency = animate(function()
											if get(isSelected) then
												return 0.5
											end
											return 1
										end,40,1),
										Size = animate(function()
											return UDim2.fromOffset(get(textboxX),2)
										end,40,1),

										[children] = {
											UICorner(0,1)
										}
									}
								}
							},
							new "TextButton" {
								Interactable = computed(function()
									if not get(isEnabled) then
										return false
									end
									return get(isSelected)
								end),
								Size = UDim2.new(0.8,-5,0.5,0),
								BackgroundTransparency = 1,

								[onevent "MouseButton1Down"] = function()
									button1Down:set(true)
								end,
								[onevent "TouchLongPress"] = function()
									button1Down:set(true)
								end,
								[onevent "InputBegan"] = function(input)
									if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch and get(textbuttonRef) then
										local mPos = UserInputService:GetMouseLocation().X
										local gPos = get(textbuttonRef).Size.X.Offset
										local Diff = mPos - (get(textbuttonRef).AbsolutePosition.X + gPos)

										while get(button1Down) and task.wait() do
											local nMPos = UserInputService:GetMouseLocation().X
											local nX = math.clamp(gPos + (nMPos - mPos) + Diff, 0, get(textbuttonRef).AbsoluteSize.X)

											_flag.status.percentageOf:set(round(mapValue(nX, 0, get(textbuttonRef).AbsoluteSize.X, get(min), get(max))))
											RunService.RenderStepped:Wait()
										end
									end
								end,

								[ref] = textbuttonRef,

								[children] = {
									UIPadding(0,6),
									new "Frame" {
										AnchorPoint = Vector2.new(0,0.5),
										Position = UDim2.fromScale(0,0.5),
										Size = UDim2.new(1,0,0,4),
										BackgroundColor3 = theme.background,
										BackgroundTransparency = selectedAnimation,

										[children] = {
											UICorner(0,1)
										}
									},
									new "Frame" {
										AnchorPoint = Vector2.new(0,0.5),
										Position = UDim2.fromScale(0,0.5),
										BackgroundColor3 = theme.text,
										BackgroundTransparency = selectedAnimation,
										Size = animate(function()
											return UDim2.new(get(percentage),0,0,4)
										end,40,1),

										[children] = {
											UICorner(0,1),
											new "ImageLabel" {
												Image = icons.circle,
												BackgroundTransparency = 1,
												ImageColor3 = theme.selectedTab,
												ImageTransparency = selectedAnimation,
												Size = UDim2.fromOffset(18,18),
												Position = UDim2.new(1,0,0.5,0),
												AnchorPoint = Vector2.new(0.5,0.5),

												[children] = {
													new "Frame" {
														Position = UDim2.new(0.5,0,0.5,0),
														AnchorPoint = Vector2.new(0.5,0.5),
														Size = UDim2.fromOffset(2,8),
														BackgroundColor3 = theme.text,
														BackgroundTransparency = animate(function()
															if get(isSelected) then
																return 0.8
															end
															return 1
														end,40,1)
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

	-- Closure

	if get(useConfig.boolean) and not get(ignoreConfig) then
		_flag.file:Connect(function(file)
			local noPercentageOf = true
			if file ~= nil then
				_flag.status.percentageOf:set(math.clamp(file, get(min), get(max)))
				noPercentageOf = false
			end
			if noPercentageOf then
				_flag.status.percentageOf:set(get(default))
			end
		end)
		if _flag.private then
			_flag.status.percentageOf:set(get(default))
		end
	else
		_flag.status.percentageOf:set(get(default))
	end
	if _flag.preregistered and _flag.preregisteredValue and typeof(_flag.preregisteredValue) == "number" then
		_flag.status.percentageOf:set(math.clamp(_flag.preregisteredValue, get(min), get(max)))
	end

	local returnFunctions = {}
	function returnFunctions:SetName(newText)
		local _didPass, _failedItems = typecheck({['SetName'] = newText}, {SetName = ""})
		assert(_didPass, table.concat(_failedItems, "\n"))

		name:set(newText)
	end
	function returnFunctions:SetValue(newValue)
		local _didPass, _failedItems = typecheck({['SetValue'] = newValue}, {SetValue = 0})
		assert(_didPass, table.concat(_failedItems, "\n"))

		_flag.status.percentageOf:set(math.clamp(newValue, get(min), get(max)))
	end
	function returnFunctions:Enable()
		isEnabled:set(true)
	end
	function returnFunctions:Disable()
		isEnabled:set(false)
	end
	function returnFunctions:Visible()
		visible:set(true)
	end
	function returnFunctions:Invisible()
		visible:set(false)
	end
	return returnFunctions
end