for W,q in pairs(Navigation:GetChildren())do if q:IsA("\084\101\120\116\066\117\116\116\111\110")then q.MouseButton1Click:connect(function()local W local s local h=q.Name if h~=CurrentFrame and not Tweening then for W,s in pairs(Navigation:GetChildren())do if s:IsA("\084\101\120\116\066\117\116\116\111\110")then s.Style=s==q and Enum.ButtonStyle.RobloxRoundDefaultButton or Enum.ButtonStyle.RobloxRoundButton end end Tweening=true for q,x in pairs(NavOrder)do if x==CurrentFrame then W=q elseif x==h then s=q end end local x=s>W and true or false local K=x and UDim2.new(-1,0,0,0)or UDim2.new(1,0,0)local X=x and UDim2.new(1,0,0,0)or UDim2.new(-1,0,0,0)Main[h].Position=X Main[CurrentFrame]:TweenPosition(K,Direction,Style,Time,false)Main[h]:TweenPosition(UDim2.new(0,0,0,0),Direction,Style,Time,false)CurrentFrame=h wait(Time)Tweening=false end end)end end
-- Navigation
for _, NavButton in pairs(Navigation:GetChildren()) do
	if NavButton:IsA("TextButton") then
		NavButton.MouseButton1Click:connect(function()
			local CurrentIndex
			local NextIndex
			local NextFrame = NavButton.Name

			if NextFrame ~= CurrentFrame and not Tweening then
				for _, Button in pairs(Navigation:GetChildren()) do
					if Button:IsA("TextButton") then
						Button.Style = (Button == NavButton and Enum.ButtonStyle.RobloxRoundDefaultButton)
							or Enum.ButtonStyle.RobloxRoundButton
					end
				end
				Tweening = true
				for Index, Frame in pairs(NavOrder) do
					if Frame == CurrentFrame then
						CurrentIndex = Index
					elseif Frame == NextFrame then
						NextIndex = Index
					end
				end
				local Forward = (NextIndex > CurrentIndex and true) or false
				local CurrentFrameTweenPosition = (Forward and UDim2.new(-1, 0, 0, 0)) or UDim2.new(1, 0, 0)
				local NextFramePosition = (Forward and UDim2.new(1, 0, 0, 0)) or UDim2.new(-1, 0, 0, 0)
				Main[NextFrame].Position = NextFramePosition
				Main[CurrentFrame]:TweenPosition(CurrentFrameTweenPosition, Direction, Style, Time, false)
				Main[NextFrame]:TweenPosition(UDim2.new(0, 0, 0, 0), Direction, Style, Time, false)
				CurrentFrame = NextFrame
				wait(Time)
				Tweening = false
			end
		end)
	end
end
