-- AdminPanel (LocalScript, StarterPlayerScripts): admin panel, only for admins (attribute IsAdmin from -- OrnamentAdminServer; the server checks the admin list again on every action). -- left : players on this server (name, level, shards, toys, tutorial) — click to select (you are first) -- shards : give / take any amount, quick +100 / +1 000 / +10 000 -- level : set any level (1..MAX_LEVEL); boosters: - / + per booster -- player : reset the tutorial (it starts right away) / reset all statistics (second click confirms) -- all : reset the tutorial of every player (online now + everyone who joins later, all servers) -- Open / close: the "Админ" button at the bottom left or F2. local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local UIS = game:GetService("UserInputService") local player = Players.LocalPlayer local folder = ReplicatedStorage:WaitForChild("OrnamentMachine") local K = require(player:WaitForChild("PlayerScripts"):WaitForChild("OrnamentCraftUI"):WaitForChild("ShopKit")) local new, corner, label, maxText, pill = K.new, K.corner, K.label, K.maxText, K.pill local GOLD, SOFT, OK, WARN, WHITE, BODY, NAVY = K.GOLD, K.SOFT, K.OK, K.WARN, K.WHITE, K.BODY, K.NAVY do local t = os.clock() while player:GetAttribute("IsAdmin") == nil and os.clock() - t < 60 do task.wait(0.5) end end if player:GetAttribute("IsAdmin") ~= true then return end local fn = folder:WaitForChild("Admin", 30) if not fn then return end local W, H = 900, 830 local PANEL = Color3.fromRGB(6, 20, 26) local function fmt(n) local s = tostring(math.floor(math.abs(n))) local out = s:reverse():gsub("(%d%d%d)", "%1 "):reverse():gsub("^ ", "") return (n < 0 and "-" or "") .. out end local gui = new("ScreenGui", { Name = "AdminGui", ResetOnSpawn = false, DisplayOrder = 60, IgnoreGuiInset = true, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = player:WaitForChild("PlayerGui") }) -- toggle button (bottom left) local toggle = new("TextButton", { Name = "AdminToggle", AnchorPoint = Vector2.new(0, 1), Position = UDim2.new(0, 12, 1, -12), Size = UDim2.fromOffset(128, 44), BackgroundColor3 = NAVY, BackgroundTransparency = 0.1, AutoButtonColor = true, Text = "🛠 Admin", FontFace = K.FONT, TextSize = 22, TextColor3 = GOLD, Parent = gui }, { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = GOLD, Thickness = 2, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }), }) -- dim layer + panel local overlay = new("TextButton", { Name = "AdminOverlay", Text = "", AutoButtonColor = false, Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.45, Visible = false, Parent = gui }) overlay:SetAttribute("NoSound", true) local panel = new("Frame", { Name = "AdminPanel", AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.fromOffset(W, H), BackgroundColor3 = WHITE, Parent = overlay }, { corner(UDim.new(0, 30)), new("UIStroke", { Color = Color3.fromRGB(242, 196, 82), Thickness = 4 }), new("UIGradient", { Rotation = 90, Color = ColorSequence.new(Color3.fromRGB(22, 84, 70), Color3.fromRGB(8, 36, 44)) }), }) local scale = new("UIScale", { Parent = panel }) local function fit() local vp = workspace.CurrentCamera.ViewportSize scale.Scale = math.min(1, (vp.X - 24) / W, (vp.Y - 24) / H) end fit() workspace.CurrentCamera:GetPropertyChangedSignal("ViewportSize"):Connect(fit) local function box(pos, size) return new("Frame", { Position = pos, Size = size, BackgroundColor3 = PANEL, BackgroundTransparency = 0.35, Parent = panel }, { corner(UDim.new(0, 18)), new("UIStroke", { Color = GOLD, Thickness = 2, Transparency = 0.5 }), }) end local function title(text, pos, size) return maxText(label({ Position = pos, Size = size or UDim2.fromOffset(300, 32), Text = text, TextScaled = true, Parent = panel }, 2), 28) end maxText(label({ Position = UDim2.fromOffset(28, 18), Size = UDim2.fromOffset(560, 48), Text = "🛠 Admin Panel", TextScaled = true, Parent = panel }, 3), 42) local setOpen local closeBtn = pill(panel, { Position = UDim2.fromOffset(W - 88, 14), Size = UDim2.fromOffset(68, 58), TextMax = 30 }, function() setOpen(false) end) closeBtn.set("danger", "X") ---------------------------------------------------------------- players list title("Players on server", UDim2.fromOffset(24, 86), UDim2.fromOffset(220, 32)) local refresh -- forward local refreshBtn = pill(panel, { Position = UDim2.fromOffset(236, 80), Size = UDim2.fromOffset(124, 44), TextMax = 22 }, function() refresh() end) refreshBtn.set("alt", "Refresh") local listBox = box(UDim2.fromOffset(20, 132), UDim2.fromOffset(340, 550)) local list = K.scroll(listBox, UDim2.fromOffset(0, 0), UDim2.fromScale(1, 1), new("UIListLayout", { Padding = UDim.new(0, 8), SortOrder = Enum.SortOrder.LayoutOrder })) new("UIPadding", { PaddingLeft = UDim.new(0, 8), PaddingRight = UDim.new(0, 16), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 8), Parent = list }) ---------------------------------------------------------------- selected player local card = box(UDim2.fromOffset(380, 80), UDim2.fromOffset(500, 120)) local selName = maxText(label({ Position = UDim2.fromOffset(18, 10), Size = UDim2.fromOffset(464, 44), Text = "", TextScaled = true, Parent = card }, 2.5), 34) local selInfo = maxText(label({ Position = UDim2.fromOffset(18, 58), Size = UDim2.fromOffset(464, 52), Text = "", TextScaled = true, TextWrapped = true, FontFace = BODY, TextColor3 = SOFT, TextYAlignment = Enum.TextYAlignment.Top, Parent = card }, 1.5), 22) title("Shards", UDim2.fromOffset(384, 214)) local amountWrap = new("Frame", { Position = UDim2.fromOffset(380, 252), Size = UDim2.fromOffset(180, 56), BackgroundColor3 = NAVY, Parent = panel }, { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = Color3.fromRGB(190, 225, 255), Thickness = 2 }), }) K.art("crystal", { Position = UDim2.new(0, -8, 0.5, -28), Size = UDim2.fromOffset(56, 56), ZIndex = 2, Parent = amountWrap }) local amountBox = new("TextBox", { Position = UDim2.fromOffset(46, 6), Size = UDim2.new(1, -60, 1, -12), BackgroundTransparency = 1, Text = "100", PlaceholderText = "amount", ClearTextOnFocus = false, FontFace = K.FONT, TextScaled = true, TextColor3 = WHITE, ZIndex = 2, Parent = amountWrap }) maxText(amountBox, 32) amountBox:GetPropertyChangedSignal("Text"):Connect(function() local d = amountBox.Text:gsub("%D", ""):sub(1, 8) if d ~= amountBox.Text then amountBox.Text = d end end) local selectedId = player.UserId local players = {} local busy = false local status = maxText(label({ Position = UDim2.fromOffset(24, 782), Size = UDim2.fromOffset(852, 40), Text = "", TextScaled = true, FontFace = BODY, TextColor3 = SOFT, TextXAlignment = Enum.TextXAlignment.Center, Parent = panel }, 1.5), 24) local function setStatus(text, color) status.Text = text status.TextColor3 = color or SOFT end local render local function act(action, silent, a, b, c) if busy then return nil end busy = true if not silent then setStatus("…", SOFT) end local ok, res = pcall(fn.InvokeServer, fn, action, a, b, c) busy = false if not ok or type(res) ~= "table" then if not silent then setStatus("No response from server", WARN) end return nil end if not silent then setStatus(res.msg or (res.ok and "Done" or "Failed"), res.ok and OK or WARN) end if res.players then players = res.players render() end return res end refresh = function() act("List", false) end local function amount() local n = tonumber(amountBox.Text) if not n or n <= 0 then setStatus("Enter a shard amount", WARN) return nil end return n end local giveBtn = pill(panel, { Position = UDim2.fromOffset(570, 252), Size = UDim2.fromOffset(150, 56), TextMax = 26 }, function() local n = amount() if n then act("Give", false, selectedId, n) end end) giveBtn.set("ready", "Give") local takeBtn = pill(panel, { Position = UDim2.fromOffset(730, 252), Size = UDim2.fromOffset(150, 56), TextMax = 26 }, function() local n = amount() if n then act("Give", false, selectedId, -n) end end) takeBtn.set("alt", "Take") for i, n in { 100, 1000, 10000 } do local q = pill(panel, { Position = UDim2.fromOffset(380 + (i - 1) * 170, 318), Size = UDim2.fromOffset(160, 50), TextMax = 24 }, function() act("Give", false, selectedId, n) end) q.set("alt", "+" .. fmt(n)) end ---------------------------------------------------------------- level + boosters local Config = require(folder:WaitForChild("Config")) title("Level", UDim2.fromOffset(384, 386), UDim2.fromOffset(200, 32)) local levelWrap = new("Frame", { Position = UDim2.fromOffset(380, 424), Size = UDim2.fromOffset(110, 52), BackgroundColor3 = NAVY, Parent = panel }, { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = Color3.fromRGB(190, 225, 255), Thickness = 2 }), }) local levelBox = new("TextBox", { Position = UDim2.fromOffset(12, 6), Size = UDim2.new(1, -24, 1, -12), BackgroundTransparency = 1, Text = "", PlaceholderText = "1-" .. Config.MAX_LEVEL, ClearTextOnFocus = false, FontFace = K.FONT, TextScaled = true, TextColor3 = WHITE, Parent = levelWrap }) maxText(levelBox, 30) levelBox:GetPropertyChangedSignal("Text"):Connect(function() local d = levelBox.Text:gsub("%D", ""):sub(1, 3) if d ~= levelBox.Text then levelBox.Text = d end end) local levelBtn = pill(panel, { Position = UDim2.fromOffset(498, 424), Size = UDim2.fromOffset(112, 52), TextMax = 24 }, function() local n = tonumber(levelBox.Text) if not n or n < 1 then setStatus("Enter a level from 1 to " .. Config.MAX_LEVEL, WARN) return end act("SetLevel", false, selectedId, n) end) levelBtn.set("ready", "Set") title("Boosters", UDim2.fromOffset(634, 386), UDim2.fromOffset(200, 32)) local boosterIds = {} for id in Config.BOOSTERS do table.insert(boosterIds, id) end table.sort(boosterIds, function(x, y) return (Config.BOOSTERS[x].Order or 0) < (Config.BOOSTERS[y].Order or 0) end) local boosterLabels = {} for i, id in boosterIds do local b = Config.BOOSTERS[id] local y = 424 + (i - 1) * 58 local row = box(UDim2.fromOffset(630, y), UDim2.fromOffset(250, 52)) boosterLabels[id] = maxText(label({ Position = UDim2.fromOffset(12, 8), Size = UDim2.fromOffset(120, 36), Text = b.Name, TextScaled = true, TextColor3 = b.Color or WHITE, Parent = row }, 1.5), 22) local minus = pill(row, { Position = UDim2.fromOffset(136, 4), Size = UDim2.fromOffset(52, 44), TextMax = 30 }, function() act("Booster", false, selectedId, id, -1) end) minus.set("alt", "-") local plus = pill(row, { Position = UDim2.fromOffset(194, 4), Size = UDim2.fromOffset(52, 44), TextMax = 30 }, function() act("Booster", false, selectedId, id, 1) end) plus.set("ready", "+") end local Y0 = 424 + #boosterIds * 58 + 8 -- the next section starts under the boosters -- a dangerous button: the first click arms it ("Точно? Ещё раз"), the second (within 4 s) runs it local function confirmButton(pos, size, caption, kind, run) local btn local armedAt = 0 btn = pill(panel, { Position = pos, Size = size, TextMax = 24 }, function() if os.clock() - armedAt < 4 then armedAt = 0 btn.set(kind, caption) run() else local my = os.clock() armedAt = my btn.set("confirm", "Sure? Click again") task.delay(4, function() if armedAt == my then armedAt = 0; btn.set(kind, caption) end end) end end) btn.set(kind, caption) return btn end title("Reset", UDim2.fromOffset(384, Y0)) local function afterOwnReset(res) -- own tutorial / stats reset: close the panel so the tutorial is not hidden behind it if res and res.ok and selectedId == player.UserId then setOpen(false) end end confirmButton(UDim2.fromOffset(380, Y0 + 40), UDim2.fromOffset(245, 62), "Reset tutorial", "alt", function() afterOwnReset(act("ResetTutorial", false, selectedId)) end) confirmButton(UDim2.fromOffset(635, Y0 + 40), UDim2.fromOffset(245, 62), "Reset stats", "danger", function() afterOwnReset(act("ResetStats", false, selectedId)) end) maxText(label({ Position = UDim2.fromOffset(384, Y0 + 110), Size = UDim2.fromOffset(496, 44), Text = "Stats: level, shards, ornaments, upgrades, boosters, plot decorations, market listings. Robux purchases are kept.", TextScaled = true, TextWrapped = true, FontFace = BODY, TextColor3 = SOFT, TextYAlignment = Enum.TextYAlignment.Top, Parent = panel }, 1), 17) ---------------------------------------------------------------- everyone new("Frame", { Position = UDim2.fromOffset(20, 708), Size = UDim2.fromOffset(W - 40, 2), BackgroundColor3 = GOLD, BackgroundTransparency = 0.5, BorderSizePixel = 0, Parent = panel }) title("For all players", UDim2.fromOffset(24, 728), UDim2.fromOffset(260, 34)) confirmButton(UDim2.fromOffset(300, 718), UDim2.fromOffset(360, 56), "Reset tutorial for EVERYONE", "danger", function() act("ResetTutorialAll", false) end) ---------------------------------------------------------------- render local shownId = nil -- the player whose level is in the level box local function entryOf(id) for _, e in players do if e.id == id then return e end end return nil end render = function() if not entryOf(selectedId) then selectedId = player.UserId end for _, c in list:GetChildren() do if c:IsA("GuiObject") then c:Destroy() end end table.sort(players, function(x, y) if (x.id == player.UserId) ~= (y.id == player.UserId) then return x.id == player.UserId end return x.display:lower() < y.display:lower() end) for i, e in players do local sel = e.id == selectedId local row = new("TextButton", { Text = "", AutoButtonColor = true, Size = UDim2.new(1, 0, 0, 68), LayoutOrder = i, BackgroundColor3 = sel and Color3.fromRGB(70, 56, 20) or Color3.fromRGB(14, 40, 50), Parent = list }, { corner(UDim.new(0, 14)), new("UIStroke", { Color = sel and GOLD or Color3.fromRGB(90, 130, 140), Thickness = sel and 3 or 1.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }) }) maxText(label({ Position = UDim2.fromOffset(12, 6), Size = UDim2.new(1, -24, 0, 30), Text = e.display .. (e.id == player.UserId and " (you)" or "") .. (e.admin and " 🛠" or ""), TextScaled = true, Parent = row }, 1.5), 24) maxText(label({ Position = UDim2.fromOffset(12, 38), Size = UDim2.new(1, -24, 0, 22), Text = e.loaded and ("Lvl " .. e.level .. " · " .. fmt(e.shards) .. " shards · tutorial: " .. (e.tutorial and "done" or "no")) or "loading data…", TextScaled = true, FontFace = BODY, TextColor3 = SOFT, Parent = row }, 1), 18) row.Activated:Connect(function() selectedId = e.id render() end) end local e = entryOf(selectedId) if e and e.id ~= shownId then shownId = e.id if not levelBox:IsFocused() then levelBox.Text = e.loaded and tostring(e.level) or "" end end for id, lbl in boosterLabels do lbl.Text = Config.BOOSTERS[id].Name .. ": " .. ((e and e.boosters and e.boosters[id]) or 0) end if e then selName.Text = e.display .. " @" .. e.name .. (e.id == player.UserId and " (you)" or "") selInfo.Text = e.loaded and ("Level " .. e.level .. " · shards " .. fmt(e.shards) .. " · ornaments " .. e.toys .. "\nTutorial: " .. (e.tutorial and "done" or "not done")) or "Player data is still loading" end end ---------------------------------------------------------------- open / close setOpen = function(v) overlay.Visible = v toggle.Text = v and "Close" or "🛠 Admin" if v then setStatus("", SOFT) act("List", true) end end toggle.Activated:Connect(function() setOpen(not overlay.Visible) end) UIS.InputBegan:Connect(function(input, gp) if not gp and input.KeyCode == Enum.KeyCode.F2 then setOpen(not overlay.Visible) end end) -- keep the list fresh while the panel is open task.spawn(function() while true do task.wait(5) if overlay.Visible and not busy then act("List", true) end end end)