for u,v in pairs(Navigation:GetChildren())do if v:IsA("\084\101\120\116\066\117\116\116\111\110")then v.MouseButton1Click:connect(function()local u local o local t=v.Name if t~=CurrentFrame and not Tweening then for u,o in pairs(Navigation:GetChildren())do if o:IsA("\084\101\120\116\066\117\116\116\111\110")then o.Style=o==v and Enum.ButtonStyle.RobloxRoundDefaultButton or Enum.ButtonStyle.RobloxRoundButton end end Tweening=true for v,z in pairs(NavOrder)do if z==CurrentFrame then u=v elseif z==t then o=v end end local z=o>u and true or false local y=z and UDim2.new(-1,0,0,0)or UDim2.new(1,0,0)local s=z and UDim2.new(1,0,0,0)or UDim2.new(-1,0,0,0)Main[t].Position=s Main[CurrentFrame]:TweenPosition(y,Direction,Style,Time,false)Main[t]:TweenPosition(UDim2.new(0,0,0,0),Direction,Style,Time,false)CurrentFrame=t wait(Time)Tweening=false end end)end end

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
