local p="\078\101\120\117\115\083\099\114\111\108\108\066\097\114"local u=.5 local L=20 local i="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\076\111\098\098\121\047\066\117\116\116\111\110\115\047\115\099\114\111\108\108\095\117\112\046\112\110\103"local o="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\076\111\098\098\121\047\066\117\116\116\111\110\115\047\115\099\114\111\108\108\095\100\111\119\110\046\112\110\103"local F="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\076\111\098\098\121\047\066\117\116\116\111\110\115\047\115\099\114\111\108\108\095\108\101\102\116\046\112\110\103"local t="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\076\111\098\098\121\047\066\117\116\116\111\110\115\047\115\099\114\111\108\108\095\114\105\103\104\116\046\112\110\103"local C=(require(script.Parent.Parent.Parent:WaitForChild("\078\101\120\117\115\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107\080\114\111\106\101\099\116"))):GetContext(script)local j=C:GetResource("\078\101\120\117\115\073\110\115\116\097\110\099\101\046\069\118\101\110\116\046\078\101\120\117\115\069\118\101\110\116\067\114\101\097\116\111\114")local M=C:GetResource("\078\101\120\117\115\073\110\115\116\097\110\099\101\046\078\101\120\117\115\079\098\106\101\099\116")local f=C:GetResource("\066\097\115\101\046\078\101\120\117\115\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101")local Y=(C:GetResource("\068\097\116\097\046\069\110\117\109\046\078\101\120\117\115\069\110\117\109\067\111\108\108\101\099\116\105\111\110")).GetBuiltInEnums()local s=f:Extend()s:SetClassName(p)C:SetContextResource(s)local function Z(p,u,L)local i,o=L.AbsoluteSize,L.AbsolutePosition return p>=o.X and(p<=o.X+i.X and(u>=o.Y and u<=o.Y+i.Y))end function s.__new(F,i,o)F:InitializeSuper("\070\114\097\109\101")F.Name=p F.__StartPosition=0 F.__EndPosition=0 F:__SetChangedOverride("\066\117\116\116\111\110\049\080\114\101\115\115\101\100",function() end)F.Button1Pressed=j:CreateEvent()F:__SetChangedOverride("\066\117\116\116\111\110\050\080\114\101\115\115\101\100",function() end)F.Button2Pressed=j:CreateEvent()local t=f.GetInstance("\070\114\097\109\101")t.BorderSizePixel=1 t.Name="\083\099\114\111\108\108\066\097\114"t.Hidden=true t.Parent=F F.__ScrollBar=t local C=f.GetInstance("\084\101\120\116\066\117\116\116\111\110")C.Hidden=true C.Name="\066\117\116\116\111\110\049"C.Text=""C.Parent=F F.__Button1=C local M=f.GetInstance("\084\101\120\116\066\117\116\116\111\110")M.Hidden=true M.Name="\066\117\116\116\111\110\050"M.Text=""M.Parent=F F.__Button2=M F:__ApplyQt5Theme(o)local Y if o==Enum.Axis.X then function Y()local p=F.AbsoluteSize local u,L=F.__StartPosition,F.__EndPosition local i,o=F.RelativePosition or 0,F.RelativeSize or 1 if o<1 then o=1 end local C=(L-u)/o local j=i*((L-u)-C)t.Size=UDim2.new(0,C,1,0)t.Position=UDim2.new(0,u+j,0,0)end elseif o==Enum.Axis.Y then function Y()local p=F.AbsoluteSize local u,L=F.__StartPosition,F.__EndPosition local i,o=F.RelativePosition or 0,F.RelativeSize or 1 if o<1 then o=1 end local C=(L-u)/o local j=i*((L-u)-C)t.Size=UDim2.new(1,0,0,C)t.Position=UDim2.new(0,0,0,u+j)end end F:__SetChangedOverride("\082\101\108\097\116\105\118\101\080\111\115\105\116\105\111\110",Y)F:__SetChangedOverride("\082\101\108\097\116\105\118\101\083\105\122\101",Y);(F:GetPropertyChangedSignal("\095\095\083\116\097\114\116\080\111\115\105\116\105\111\110")):Connect(Y);(F:GetPropertyChangedSignal("\095\095\069\110\100\080\111\115\105\116\105\111\110")):Connect(Y)local s,E local g,a C.MouseButton1Down:Connect(function()F.Button1Pressed:Fire()s=tick()g=tick()while s do local p=tick()if p-s>=u and p-g>=1/L then F.Button1Pressed:Fire()g=p end wait()end end)C.MouseButton1Up:Connect(function()s=nil end)M.MouseButton1Down:Connect(function()F.Button2Pressed:Fire()E=tick()a=tick()while E do local p=tick()if p-E>=u and p-a>=1/L then F.Button2Pressed:Fire()a=p end wait()end end)M.MouseButton1Up:Connect(function()E=nil end)local J,q local O if o==Enum.Axis.X then function O(p)local u=p.X-q.X local L=F.__EndPosition-F.__StartPosition local i=L*(1-1/F.RelativeSize)F.RelativePosition=math.clamp(F.RelativePosition+u/i,0,1)q=p end elseif o==Enum.Axis.Y then function O(p)local u=p.Y-q.Y local L=F.__EndPosition-F.__StartPosition local i=L*(1-1/F.RelativeSize)F.RelativePosition=math.clamp(F.RelativePosition+u/i,0,1)q=p end end t:ConnectToHighestParent("\073\110\112\117\116\066\101\103\097\110",function(p)if p.UserInputType==Enum.UserInputType.MouseButton1 and Z(p.Position.X,p.Position.Y,t)then J=p.Position q=J end end)t:ConnectToHighestParent("\073\110\112\117\116\067\104\097\110\103\101\100",function(p)if J and p.UserInputType==Enum.UserInputType.MouseMovement then O(p.Position)end end)t:ConnectToHighestParent("\073\110\112\117\116\069\110\100\101\100",function(p)if p.UserInputType==Enum.UserInputType.MouseButton1 then J=nil q=nil end end)F.BackgroundColor3="\083\099\114\111\108\108\066\097\114\066\097\099\107\103\114\111\117\110\100"F.BorderColor3="\066\111\114\100\101\114"F.ScrollColor3="\083\099\114\111\108\108\066\097\114"F.ScrollArrowColor3="\084\105\116\108\101\098\097\114\084\101\120\116"F.BorderSizePixel=1 F.RelativePosition=0 F.RelativeSize=2 if o==Enum.Axis.X then F.Size=UDim2.new(0,200,0,50)elseif o==Enum.Axis.Y then F.Size=UDim2.new(0,50,0,200)end end function s.__ApplyQt5Theme(u,p)local L=u.__ScrollBar L.BorderSizePixel=1 local C=u.__Button1 C.BorderColor3="\066\111\114\100\101\114"C.Size=UDim2.new(1,0,1,0)if p==Enum.Axis.X then C.SizeConstraint=Enum.SizeConstraint.RelativeYY elseif p==Enum.Axis.Y then C.SizeConstraint=Enum.SizeConstraint.RelativeXX end local j=f.GetInstance("\073\109\097\103\101\076\097\098\101\108")j.Hidden=true j.BackgroundTransparency=1 j.Position=UDim2.new(.5,0,.5,0)j.AnchorPoint=Vector2.new(.5,.5)j.Parent=C if p==Enum.Axis.X then j.Image=F j.Size=UDim2.new(.375,0,.625,0)elseif p==Enum.Axis.Y then j.Image=i j.Size=UDim2.new(.625,0,.375,0)end local M=u.__Button2 M.BorderColor3="\066\111\114\100\101\114"M.Size=UDim2.new(1,0,1,0)M.AnchorPoint=Vector2.new(1,1)M.Position=UDim2.new(1,0,1,0)if p==Enum.Axis.X then M.SizeConstraint=Enum.SizeConstraint.RelativeYY elseif p==Enum.Axis.Y then M.SizeConstraint=Enum.SizeConstraint.RelativeXX end local Y=f.GetInstance("\073\109\097\103\101\076\097\098\101\108")Y.Hidden=true Y.BackgroundTransparency=1 Y.Position=UDim2.new(.5,0,.5,0)Y.AnchorPoint=Vector2.new(.5,.5)Y.Parent=M if p==Enum.Axis.X then Y.Image=t Y.Size=UDim2.new(.375,0,.625,0)elseif p==Enum.Axis.Y then Y.Image=o Y.Size=UDim2.new(.625,0,.375,0)end;(u:GetPropertyChangedSignal("\066\111\114\100\101\114\067\111\108\111\114\051")):Connect(function()L.BorderColor3=u.BorderColor3 C.BorderColor3=u.BorderColor3 M.BorderColor3=u.BorderColor3 end);(u:GetPropertyChangedSignal("\066\111\114\100\101\114\083\105\122\101\080\105\120\101\108")):Connect(function()L.BorderSizePixel=u.BorderSizePixel C.BorderSizePixel=u.BorderSizePixel M.BorderSizePixel=u.BorderSizePixel end)u:__SetChangedOverride("\083\099\114\111\108\108\067\111\108\111\114\051",function()L.BackgroundColor3=u.ScrollColor3 C.BackgroundColor3=u.ScrollColor3 C.BackgroundColor3=u.ScrollColor3 end)u:__SetChangedOverride("\083\099\114\111\108\108\065\114\114\111\119\067\111\108\111\114\051",function()j.ImageColor3=u.ScrollArrowColor3 Y.ImageColor3=u.ScrollArrowColor3 end);(u:GetPropertyChangedSignal("\090\073\110\100\101\120")):Connect(function()local p=u.ZIndex L.ZIndex=p C.ZIndex=p M.ZIndex=p j.ZIndex=p Y.ZIndex=p end)local s if p==Enum.Axis.X then function s()local p=u.AbsoluteSize local L=p.X local i=p.Y+u.BorderSizePixel local o=L-2*i if o>0 then C.Visible=true M.Visible=true u.__StartPosition=i u.__EndPosition=i+o else C.Visible=false M.Visible=false u.__StartPosition=0 u.__EndPosition=L end end elseif p==Enum.Axis.Y then function s()local p=u.AbsoluteSize local L=p.Y local i=p.X+u.BorderSizePixel local o=L-2*i if o>0 then C.Visible=true M.Visible=true u.__StartPosition=i u.__EndPosition=i+o else C.Visible=false M.Visible=false u.__StartPosition=0 u.__EndPosition=L end end end;(u:GetPropertyChangedSignal("\065\098\115\111\108\117\116\101\083\105\122\101")):Connect(s);(u:GetPropertyChangedSignal("\066\111\114\100\101\114\083\105\122\101\080\105\120\101\108")):Connect(s)end return s
--[[
TheNexusAvenger

Frame that adds scroll frame functionality
--]]

local CLASS_NAME = "NexusScrollBar"

local SCROLL_BUTTON_HOLD_TIME = 0.5
local SCROLL_BUTTON_HOLD_STEPS_PER_SECOND = 20

local SCROLL_BUTTON_IMAGE_UP = "rbxasset://textures/ui/Lobby/Buttons/scroll_up.png"
local SCROLL_BUTTON_IMAGE_DOWN = "rbxasset://textures/ui/Lobby/Buttons/scroll_down.png"
local SCROLL_BUTTON_IMAGE_LEFT = "rbxasset://textures/ui/Lobby/Buttons/scroll_left.png"
local SCROLL_BUTTON_IMAGE_RIGHT = "rbxasset://textures/ui/Lobby/Buttons/scroll_right.png"



local NexusPluginFramework = require(script.Parent.Parent.Parent:WaitForChild("NexusPluginFrameworkProject")):GetContext(script)
local NexusEventCreator = NexusPluginFramework:GetResource("NexusInstance.Event.NexusEventCreator")
local NexusObject = NexusPluginFramework:GetResource("NexusInstance.NexusObject")
local NexusWrappedInstance = NexusPluginFramework:GetResource("Base.NexusWrappedInstance")
local NexusEnums = NexusPluginFramework:GetResource("Data.Enum.NexusEnumCollection").GetBuiltInEnums()

local NexusScrollBar = NexusWrappedInstance:Extend()
NexusScrollBar:SetClassName(CLASS_NAME)
NexusPluginFramework:SetContextResource(NexusScrollBar)



--[[
Returns if a position is in a frame.
--]]
local function PointInFrame(X,Y,Frame)
	local AbsoluteSize,AbsolutePosition = Frame.AbsoluteSize,Frame.AbsolutePosition
	return X >= AbsolutePosition.X and X <= AbsolutePosition.X + AbsoluteSize.X and Y >= AbsolutePosition.Y and Y <= AbsolutePosition.Y + AbsoluteSize.Y
end



--[[
Creates a Nexus Scrolling Bar object.
--]]
function NexusScrollBar:__new(Theme,Axis)
	self:InitializeSuper("Frame")
	self.Name = CLASS_NAME
	self.__StartPosition = 0
	self.__EndPosition = 0
	
	--Create the events.
	self:__SetChangedOverride("Button1Pressed",function() end)
	self.Button1Pressed = NexusEventCreator:CreateEvent()
	self:__SetChangedOverride("Button2Pressed",function() end)
	self.Button2Pressed = NexusEventCreator:CreateEvent()
	
	--Create the scroll bar.
	local ScrollBar = NexusWrappedInstance.GetInstance("Frame")
	ScrollBar.BorderSizePixel = 1
	ScrollBar.Name = "ScrollBar"
	ScrollBar.Hidden = true
	ScrollBar.Parent = self
	self.__ScrollBar = ScrollBar
	
	--Create the buttons.
	local Button1 = NexusWrappedInstance.GetInstance("TextButton")
	Button1.Hidden = true
	Button1.Name = "Button1"
	Button1.Text = ""
	Button1.Parent = self
	self.__Button1 = Button1
	
	local Button2 = NexusWrappedInstance.GetInstance("TextButton")
	Button2.Hidden = true
	Button2.Name = "Button2"
	Button2.Text = ""
	Button2.Parent = self
	self.__Button2 = Button2
	
	--Apply the themes.
	self:__ApplyQt5Theme(Axis)
	
	--Set up updating the size.
	local UpdateScrollBar
	if Axis == Enum.Axis.X then
		function UpdateScrollBar()
			--Get the sizes and positions.
			local AbsoluteSize = self.AbsoluteSize
			local StartPosition,EndPosition = self.__StartPosition,self.__EndPosition
			local RelativePosition,RelativeSize = self.RelativePosition or 0,self.RelativeSize or 1
	 
			--Adjust the size.
			if RelativeSize < 1 then
				RelativeSize = 1
			end
			
			--Determine the scroll bar size and position.
			local ScrollBarSize = (EndPosition - StartPosition)/RelativeSize
			local ScrollBarOffset = RelativePosition * ((EndPosition - StartPosition) - ScrollBarSize)
			
			--Set the size and position of the scroll bar.
			ScrollBar.Size = UDim2.new(0,ScrollBarSize,1,0)
			ScrollBar.Position = UDim2.new(0,StartPosition + ScrollBarOffset,0,0)
		end
	elseif Axis == Enum.Axis.Y then
		function UpdateScrollBar()
			--Get the sizes and positions.
			local AbsoluteSize = self.AbsoluteSize
			local StartPosition,EndPosition = self.__StartPosition,self.__EndPosition
			local RelativePosition,RelativeSize = self.RelativePosition or 0,self.RelativeSize or 1
	 
			--Adjust the size.
			if RelativeSize < 1 then
				RelativeSize = 1
			end
			
			--Determine the scroll bar size and position.
			local ScrollBarSize = (EndPosition - StartPosition)/RelativeSize
			local ScrollBarOffset = RelativePosition * ((EndPosition - StartPosition) - ScrollBarSize)
			
			--Set the size and position of the scroll bar.
			ScrollBar.Size = UDim2.new(1,0,0,ScrollBarSize)
			ScrollBar.Position = UDim2.new(0,0,0,StartPosition + ScrollBarOffset)
		end
	end
	self:__SetChangedOverride("RelativePosition",UpdateScrollBar)
	self:__SetChangedOverride("RelativeSize",UpdateScrollBar)
	self:GetPropertyChangedSignal("__StartPosition"):Connect(UpdateScrollBar)
	self:GetPropertyChangedSignal("__EndPosition"):Connect(UpdateScrollBar)
	
	--Set up the buttons.
	local Button1Start,Button2Start
	local Button1LastInvoke,Button2LastInvoke
	Button1.MouseButton1Down:Connect(function()
		--Fire the first invoke.
		self.Button1Pressed:Fire()
		Button1Start = tick()
		Button1LastInvoke = tick()
		
		--Run the loop until the mouse button is released.
		while Button1Start do
			local CurrentTime = tick()
			if CurrentTime - Button1Start >= SCROLL_BUTTON_HOLD_TIME and CurrentTime - Button1LastInvoke >= 1/SCROLL_BUTTON_HOLD_STEPS_PER_SECOND then
				self.Button1Pressed:Fire()
				Button1LastInvoke = CurrentTime
			end
			wait()
		end
	end)

	Button1.MouseButton1Up:Connect(function()
		Button1Start = nil
	end)
	
	Button2.MouseButton1Down:Connect(function()
		--Fire the first invoke.
		self.Button2Pressed:Fire()
		Button2Start = tick()
		Button2LastInvoke = tick()
		
		--Run the loop until the mouse button is released.
		while Button2Start do
			local CurrentTime = tick()
			if CurrentTime - Button2Start >= SCROLL_BUTTON_HOLD_TIME and CurrentTime - Button2LastInvoke >= 1/SCROLL_BUTTON_HOLD_STEPS_PER_SECOND then
				self.Button2Pressed:Fire()
				Button2LastInvoke = CurrentTime
			end
			wait()
		end
	end)

	Button2.MouseButton1Up:Connect(function()
		Button2Start = nil
	end)
	
	--Set up dragging.
	local StartPosition,LastPosition
	local MoveScrollBar
	if Axis == Enum.Axis.X then
		function MoveScrollBar(CurrentPosition)
			--Determine the delta.
			local DeltaX = CurrentPosition.X - LastPosition.X
			local ScrollBarSize = self.__EndPosition - self.__StartPosition
			local EmptySpace = ScrollBarSize * (1 - (1/self.RelativeSize))
			
			--Add the delta.
			self.RelativePosition = math.clamp(self.RelativePosition + (DeltaX/EmptySpace),0,1)
			
			--Set the last position as the next position.
			LastPosition = CurrentPosition
		end
	elseif Axis == Enum.Axis.Y then
		function MoveScrollBar(CurrentPosition)
			--Determine the delta.
			local DeltaY = CurrentPosition.Y - LastPosition.Y
			local ScrollBarSize = self.__EndPosition - self.__StartPosition
			local EmptySpace = ScrollBarSize * (1 - (1/self.RelativeSize))
			
			--Add the delta.
			self.RelativePosition = math.clamp(self.RelativePosition + (DeltaY/EmptySpace),0,1)
			
			--Set the last position as the next position.
			LastPosition = CurrentPosition
		end
	end
	
	ScrollBar:ConnectToHighestParent("InputBegan",function(Input)
		if Input.UserInputType == Enum.UserInputType.MouseButton1 and PointInFrame(Input.Position.X,Input.Position.Y,ScrollBar) then
			StartPosition = Input.Position
			LastPosition = StartPosition
		end
	end)
	
	ScrollBar:ConnectToHighestParent("InputChanged",function(Input)
		if StartPosition and Input.UserInputType == Enum.UserInputType.MouseMovement then
			MoveScrollBar(Input.Position)
		end
	end)
	
	ScrollBar:ConnectToHighestParent("InputEnded",function(Input)
		if Input.UserInputType == Enum.UserInputType.MouseButton1 then
			StartPosition = nil
			LastPosition = nil
		end
	end)
	
	--Set the default colors.
	self.BackgroundColor3 = "ScrollBarBackground"
	self.BorderColor3 = "Border"
	self.ScrollColor3 = "ScrollBar"
	self.ScrollArrowColor3 = "TitlebarText"
	self.BorderSizePixel = 1
	
	--Set the size.
	self.RelativePosition = 0
	self.RelativeSize = 2
	if Axis == Enum.Axis.X then
		self.Size = UDim2.new(0,200,0,50)
	elseif Axis == Enum.Axis.Y then
		self.Size = UDim2.new(0,50,0,200)
	end
end

--[[
Applies the Qt5 theme to the scroll bar.
--]]
function NexusScrollBar:__ApplyQt5Theme(Axis)
	--Modify the scroll frame.
	local ScrollBar = self.__ScrollBar
	ScrollBar.BorderSizePixel = 1
	
	--Modify the buttons.
	local Button1 = self.__Button1
	Button1.BorderColor3 = "Border"
	Button1.Size = UDim2.new(1,0,1,0)
	if Axis == Enum.Axis.X then
		Button1.SizeConstraint = Enum.SizeConstraint.RelativeYY
	elseif Axis == Enum.Axis.Y then
		Button1.SizeConstraint = Enum.SizeConstraint.RelativeXX
	end
	
	local Arrow1 = NexusWrappedInstance.GetInstance("ImageLabel")
	Arrow1.Hidden = true
	Arrow1.BackgroundTransparency = 1
	Arrow1.Position = UDim2.new(0.5,0,0.5,0)
	Arrow1.AnchorPoint = Vector2.new(0.5,0.5)
	Arrow1.Parent = Button1
	if Axis == Enum.Axis.X then
		Arrow1.Image = SCROLL_BUTTON_IMAGE_LEFT
		Arrow1.Size = UDim2.new(6/16,0,10/16,0)
	elseif Axis == Enum.Axis.Y then
		Arrow1.Image = SCROLL_BUTTON_IMAGE_UP
		Arrow1.Size = UDim2.new(10/16,0,6/16,0)
	end
	
	local Button2 = self.__Button2
	Button2.BorderColor3 = "Border"
	Button2.Size = UDim2.new(1,0,1,0)
	Button2.AnchorPoint = Vector2.new(1,1)
	Button2.Position = UDim2.new(1,0,1,0)
	if Axis == Enum.Axis.X then
		Button2.SizeConstraint = Enum.SizeConstraint.RelativeYY
	elseif Axis == Enum.Axis.Y then
		Button2.SizeConstraint = Enum.SizeConstraint.RelativeXX
	end
	
	local Arrow2 = NexusWrappedInstance.GetInstance("ImageLabel")
	Arrow2.Hidden = true
	Arrow2.BackgroundTransparency = 1
	Arrow2.Position = UDim2.new(0.5,0,0.5,0)
	Arrow2.AnchorPoint = Vector2.new(0.5,0.5)
	Arrow2.Parent = Button2
	if Axis == Enum.Axis.X then
		Arrow2.Image = SCROLL_BUTTON_IMAGE_RIGHT
		Arrow2.Size = UDim2.new(6/16,0,10/16,0)
	elseif Axis == Enum.Axis.Y then
		Arrow2.Image = SCROLL_BUTTON_IMAGE_DOWN
		Arrow2.Size = UDim2.new(10/16,0,6/16,0)
	end
	
	--Set up colors.
	self:GetPropertyChangedSignal("BorderColor3"):Connect(function()
		ScrollBar.BorderColor3 = self.BorderColor3
		Button1.BorderColor3 = self.BorderColor3
		Button2.BorderColor3 = self.BorderColor3
	end)
	
	self:GetPropertyChangedSignal("BorderSizePixel"):Connect(function()
		ScrollBar.BorderSizePixel = self.BorderSizePixel
		Button1.BorderSizePixel = self.BorderSizePixel
		Button2.BorderSizePixel = self.BorderSizePixel
	end)
	
	self:__SetChangedOverride("ScrollColor3",function()
		ScrollBar.BackgroundColor3 = self.ScrollColor3
		Button1.BackgroundColor3 = self.ScrollColor3
		Button1.BackgroundColor3 = self.ScrollColor3
	end)
	
	self:__SetChangedOverride("ScrollArrowColor3",function()
		Arrow1.ImageColor3 = self.ScrollArrowColor3
		Arrow2.ImageColor3 = self.ScrollArrowColor3
	end)
	
	--Set up z-indexing.
	self:GetPropertyChangedSignal("ZIndex"):Connect(function()
		local ZIndex = self.ZIndex
		ScrollBar.ZIndex = ZIndex
		Button1.ZIndex = ZIndex
		Button2.ZIndex = ZIndex
		Arrow1.ZIndex = ZIndex
		Arrow2.ZIndex = ZIndex
	end)
	
	--Set up resizing.
	local ResizeFunction
	if Axis == Enum.Axis.X then
		function ResizeFunction()
			--Get the size.
			local AbsoluteSize = self.AbsoluteSize
			local FullLength = AbsoluteSize.X
			local ButtonSizeRequirement = AbsoluteSize.Y + self.BorderSizePixel
			
			--Update the buttons.
			local RemainingLength = FullLength - (2 * ButtonSizeRequirement)
			if RemainingLength > 0 then
				Button1.Visible = true
				Button2.Visible = true
				
				self.__StartPosition = ButtonSizeRequirement
				self.__EndPosition = ButtonSizeRequirement + RemainingLength
			else
				Button1.Visible = false
				Button2.Visible = false
				
				self.__StartPosition = 0
				self.__EndPosition = FullLength
			end
		end
	elseif Axis == Enum.Axis.Y then
		function ResizeFunction()
			--Get the size.
			local AbsoluteSize = self.AbsoluteSize
			local FullLength = AbsoluteSize.Y
			local ButtonSizeRequirement = AbsoluteSize.X + self.BorderSizePixel
			
			--Update the buttons.
			local RemainingLength = FullLength - (2 * ButtonSizeRequirement)
			if RemainingLength > 0 then
				Button1.Visible = true
				Button2.Visible = true
				
				self.__StartPosition = ButtonSizeRequirement
				self.__EndPosition = ButtonSizeRequirement + RemainingLength
			else
				Button1.Visible = false
				Button2.Visible = false
				
				self.__StartPosition = 0
				self.__EndPosition = FullLength
			end
		end
	end
	self:GetPropertyChangedSignal("AbsoluteSize"):Connect(ResizeFunction)
	self:GetPropertyChangedSignal("BorderSizePixel"):Connect(ResizeFunction)
end



return NexusScrollBar