-- Decompiled with the Synapse X Luau decompiler.


local v1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
while not v1.Loaded do
	game:GetService("RunService").Heartbeat:Wait();
end;
local u1 = {};
local v13
local u2 = nil;
function Update()
	if u1 then

	else
		return;
	end;
	if not u2 then
		return;
	end;

	for v5, v6 in pairs(u2:GetChildren()) do
		if v5 then

		else
			break;
		end;
		local v7 = nil
		if v6.Name == "Energy Leaderboard" then
			v7 = u1["Energy"]
		else
			v7 = u1["Gems"]
			
		end
		if v7 then
			local v8 = v6:FindFirstChildOfClass("SurfaceGui");

			for v9, v10 in ipairs(v7) do
				if v9 then

				else
					break;
				end;
				local v12 = v8.Frame:FindFirstChild("Entry" .. v9);
				if not v12 then
					v12 = v1.Assets.UI.Leaderboard.Entry:Clone();
					v12.LayoutOrder = v9;
					v12.Rank.Text = "#" .. v9;
					v12.Name = "Entry" .. v9;
					if v9 <= 3 then
						v13 = 80;
					else
						v13 = 60;
					end;
					v12.Size = UDim2.new(1, 0, 0, v13);
					v12.Parent = v8.Frame;
				end;
				v12.Score.Text = v1.Functions.Format.Short(v10.loadvalue);
				v12.Username.Text = "@" .. v10.username;
				if v10.username == v1.LocalPlayer.Name then
					v12.Username.TextColor3 = Color3.fromRGB(28, 134, 173);
				else
					v12.Username.TextColor3 = Color3.fromRGB(218, 218, 218);
				end;			
			end;
			v8.Frame.CanvasSize = UDim2.new(0, 0, 0, v8.Frame:FindFirstChildOfClass("UIListLayout").AbsoluteContentSize.Y);
		end;	
	end;
end;
function Grab()
	local v14 = v1.Network.Invoke("Get Leaderboards");
	if v14 then
		u1 = v14;
		Update();
	end;
end;
function Check()
	local v15 = v1.WorldCmds.GetMap();
	if v15:FindFirstChild("Interactive") then

	else
		return;
	end;
	u2 = v15.Interactive:FindFirstChild("Leaderboards");
	if not u2 then
		return;
	end;
	Update();
end;
v1.Signal.Fired("World Changed"):Connect(function()
	u2 = nil;
	Check();
end);
coroutine.wrap(function()
	while true do
		Grab();
		wait(10);	
	end;
end)();

