-- Decompiled with the Synapse X Luau decompiler.


local v1 = script:FindFirstAncestor("MainUI");
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local v3 = require(script.Parent);
local v4 = game["Run Service"];
local l__TweenService__5 = game:GetService("TweenService");
local l__UserInputService__6 = game:GetService("UserInputService");
local l__GuiService__7 = game:GetService("GuiService");
local l__MarketplaceService__8 = game:GetService("MarketplaceService");
local l__Parent__9 = script.Parent.Parent.Parent;
local l__SideButtons__10 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("SideButtons");
local l__Shop__11 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("Shop");
local l__Achievements__12 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("Achievements");
local v13 = require(game:GetService("ReplicatedStorage"):WaitForChild("ReplicaDataModule"));
local v14 = require(game:GetService("ReplicatedStorage"):WaitForChild("Achievements"));
local v15 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("GetProductPrice"));
local v16 = require(game:GetService("ReplicatedStorage"):WaitForChild("Products"));
while true do
	wait(0.5);
	if l__Parent__9.LobbyFrame.WarningScreen.Visible == false then
		break;
	end;
end;
l__SideButtons__10.Visible = true;
l__SideButtons__10:TweenPosition(UDim2.new(0, 0, 0.5, 50), "Out", "Quad", 1, true);
local u1 = l__UserInputService__6.GamepadEnabled;
function update()
	if u1 then
		if l__Shop__11.Visible then
			l__GuiService__7.SelectedObject = l__Shop__11.Frame.Products.Boost;
		elseif l__Achievements__12.Visible then
			l__GuiService__7.SelectedObject = l__Achievements__12.Frame;
		else
			l__GuiService__7.SelectedObject = nil;
		end;
	else
		l__GuiService__7.SelectedObject = nil;
	end;
	if l__Achievements__12.Visible then
		return;
	end;
	if l__Shop__11.Visible then
		if v13.data then
			if v13.data.PaidInKnobs then
				if 2400 <= v13.data.PaidInKnobs then
					l__Shop__11.Frame.Products.Frame[1].Visible = false;
					l__Shop__11.Frame.Products.Frame[2].Visible = false;
					l__Shop__11.Frame.Products.Frame[3].Visible = false;
					l__Shop__11.Frame.Products.Frame[4].Visible = false;
					l__Shop__11.Frame.Products.Frame[5].Visible = true;
					l__Shop__11.Frame.Products.Frame[6].Visible = true;
					l__Shop__11.Frame.Products.Frame[7].Visible = true;
					l__Shop__11.Frame.Products.Frame.Back.Visible = true;
				end;
			end;
		end;
	end;
end;
l__SideButtons__10.ButtonShop.MouseButton1Down:Connect(function()
	l__Shop__11.Visible = not l__Shop__11.Visible;
	l__Achievements__12.Visible = false;
	update();
end);
l__SideButtons__10.ButtonAchievements.MouseButton1Down:Connect(function()
	l__Achievements__12.Visible = not l__Achievements__12.Visible;
	l__Shop__11.Visible = false;
	update();
end);
l__Shop__11.CloseButton.MouseButton1Down:Connect(function()
	l__Shop__11.Visible = false;
	update();
end);
l__Shop__11:WaitForChild("Code").Confirm.MouseButton1Down:Connect(function()
	game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Shop__11:WaitForChild("Code").ReturnPressedFromOnScreenKeyboard:Connect(function()
	game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Shop__11:WaitForChild("Code").FocusLost:Connect(function()
	game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Achievements__12.CloseButton.MouseButton1Down:Connect(function()
	l__Achievements__12.Visible = false;
	update();
end);
for v17, v18 in l__Shop__11() do
	if v18:IsA("TextButton") then
		if v18:GetAttribute("ProductID") ~= nil and (v18.Visible or v18:GetAttribute("DoAnyway")) then
			v18.Price.Text = v15(v18:GetAttribute("ProductID"));
			v18.MouseButton1Down:Connect(function()
				l__MarketplaceService__8:PromptProductPurchase(l__LocalPlayer__2, v18:GetAttribute("ProductID"));
			end);
		elseif v18:GetAttribute("BuyPremium") then
			v18.MouseButton1Down:Connect(function()
				l__MarketplaceService__8:PromptPremiumPurchase(l__LocalPlayer__2);
			end);
			pcall(function()
				if l__LocalPlayer__2.MembershipType == Enum.MembershipType.Premium then
					v18.Visible = false;
				end;
			end);
		elseif v18:GetAttribute("GoBack") then
			l__Shop__11.Frame.Products.Frame[1].Visible = true;
			l__Shop__11.Frame.Products.Frame[2].Visible = true;
			l__Shop__11.Frame.Products.Frame[3].Visible = true;
			l__Shop__11.Frame.Products.Frame[4].Visible = true;
			l__Shop__11.Frame.Products.Frame[5].Visible = false;
			l__Shop__11.Frame.Products.Frame[6].Visible = false;
			l__Shop__11.Frame.Products.Frame[7].Visible = false;
			l__Shop__11.Frame.Products.Frame.Back.Visible = false;
		end;
	end;
end;
l__UserInputService__6.InputBegan:Connect(function(p1, p2)
	if p2 then
		return;
	end;
	if p1.KeyCode == Enum.KeyCode.ButtonB then
		l__Shop__11.Visible = false;
		l__Achievements__12.Visible = false;
		update();
		return;
	end;
	if p1.KeyCode == Enum.KeyCode.ButtonX then
		if not l__GuiService__7.SelectedObject then
			l__GuiService__7.SelectedObject = l__SideButtons__10.ButtonShop;
			return;
		end;
	else
		return;
	end;
	l__Shop__11.Visible = false;
	l__Achievements__12.Visible = false;
	l__GuiService__7.SelectedObject = nil;
end);
local function v19()
	u1 = l__UserInputService__6.GamepadEnabled;
	for v20, v21 in pairs(game:GetService("CollectionService"):GetTagged("XBox")) do
		v21.Visible = u1;
	end;
end;
l__UserInputService__6.GamepadConnected:Connect(v19);
l__UserInputService__6.GamepadDisconnected:Connect(v19);
u1 = l__UserInputService__6.GamepadEnabled;
for v22, v23 in pairs(game:GetService("CollectionService"):GetTagged("XBox")) do
	v23.Visible = u1;
end;
while true do
	wait(1);
	if v13.data then
		break;
	end;
end;
for v24, v25 in pairs(l__Achievements__12.List:GetChildren()) do
	if v25:IsA("ImageButton") and v25.Visible then
		v25:Destroy();
	end;
end;
if v13.data then
	local v26, v27, v28 = pairs(v14);
	while true do
		local v29, v30 = v26(v27, v28);
		if not v29 then
			break;
		end;
		local v31 = v30:GetInfo();
		local v32 = l__Achievements__12.List.Badge:Clone();
		for v33, v34 in pairs(v31) do
			v32:SetAttribute(v33, v34);
		end;
		v32.Image = v31.Image;
		v32.Name = "Achievement" .. v31.Name;
		v32.Parent = l__Achievements__12.List;
		v32.LayoutOrder = 1000 + v31.Category;
		v32.Visible = true;
		if table.find(v13.data.Achievements, v31.Name) then
			v32.ImageColor3 = Color3.new(1, 1, 1);
			v32.ImageTransparency = 0;
			v32.LayoutOrder = v32.LayoutOrder - 1000;
			v32.UIStroke.Enabled = false;
			v31.Hidden = -1;
		end;
		local function v35()
			l__Achievements__12.Frame.Title.Text = v31.Hidden < 3 and v31.Title or "Locked Achievement";
			l__Achievements__12.Frame.Desc.Text = v31.Hidden < 2 and v31.Desc or "Unlock this achievement to view its description!";
			l__Achievements__12.Frame.Reason.Text = v31.Hidden < 1 and v31.Reason or "";
			l__Achievements__12.Frame.ImageLabel.Image = v31.Image;
			l__Achievements__12.Frame.Visible = true;
		end;
		v32.MouseButton1Down:Connect(v35);
		v32.SelectionGained:Connect(v35);	
	end;
end;
