1→-- ShopKit: shared pieces of the New Year shop-style windows (Мастерская, Рынок). 2→-- Art from GUI/магазин: snowy green panel, red ribbon, pill buttons, ray cards, crystal, holly, gift. 3→-- Design canvas 1400 x 1000 px; OrnamentCraftUI's openWindow() scales it to the screen. 4→-- 5→-- K.pill : action button with states 6→-- ready (gold) / alt (blue) / confirm, danger (red) — clickable 7→-- done (green) / info (blue) — inert, off (grey, says what is missing) / busy (•••, waiting for the server) 8→-- hover = grow + light ring, press = shrink + darken, a click on "off" wiggles it. 9→-- K.chip : filter chip (green, gold when selected), same hover / press feel. 10→-- K.chrome : the whole window frame — gradient body, stars, garlands, ribbon title, balance plate, close button, 11→-- content panel, tip line and up to 4 tabs (normal / hover / pressed / selected + red badge). 12→local TweenService = game:GetService("TweenService") 13→ 14→local K = {} 15→ 16→K.FONT = Font.new("rbxasset://fonts/families/FredokaOne.json", Enum.FontWeight.Bold) 17→K.BODY = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Bold) 18→K.INK = Color3.fromRGB(12, 8, 10) 19→K.WHITE = Color3.new(1, 1, 1) 20→K.GOLD = Color3.fromRGB(255, 211, 116) 21→K.SOFT = Color3.fromRGB(222, 238, 230) 22→K.OK = Color3.fromRGB(150, 255, 160) 23→K.WARN = Color3.fromRGB(255, 196, 120) 24→K.NAVY = Color3.fromRGB(14, 26, 58) 25→local FONT, BODY, INK, WHITE, GOLD, SOFT, OK, NAVY = K.FONT, K.BODY, K.INK, K.WHITE, K.GOLD, K.SOFT, K.OK, K.NAVY 26→ 27→-- art (id, opaque rect in the source png) 28→K.ART = { 29→ panel = { "rbxassetid://138527541920438", { 18, 42, 278, 234 } }, 30→ ribbon = { "rbxassetid://103499479509351", { 10, 74, 294, 166 } }, 31→ green = { "rbxassetid://93987797017793", { 16, 110, 280, 102 } }, 32→ red = { "rbxassetid://138508596098174", { 18, 108, 280, 102 } }, 33→ blue = { "rbxassetid://111888989174975", { 18, 114, 278, 94 } }, 34→ gold = { "rbxassetid://131564766133063", { 16, 108, 280, 102 } }, 35→ grey = { "rbxassetid://89653402754634", { 16, 108, 280, 102 } }, 36→ crystal = { "rbxassetid://105804941618750", { 54, 56, 206, 210 } }, 37→ cardGreen = { "rbxassetid://105142745227171", { 16, 22, 280, 272 } }, 38→ cardCyan = { "rbxassetid://116968687145512", { 18, 22, 280, 272 } }, 39→ cardViolet = { "rbxassetid://103872013133887", { 16, 22, 282, 272 } }, 40→ cardOrange = { "rbxassetid://125846279529125", { 18, 22, 280, 272 } }, 41→ gift = { "rbxassetid://85573436333424" }, 42→ holly = { "rbxassetid://96646166091621" }, 43→ garland = { "rbxassetid://133428323657868" }, 44→} 45→K.CARD_SLICE = Rect.new(34, 60, 246, 206) 46→local ART = K.ART 47→ 48→function K.tween(o, t, props, style, dir) 49→ local tw = TweenService:Create(o, TweenInfo.new(t, style or Enum.EasingStyle.Quad, dir or Enum.EasingDirection.Out), props) 50→ tw:Play() 51→ return tw 52→end 53→local tween = K.tween 54→function K.new(class, props, children) 55→ local o = Instance.new(class) 56→ for k, v in props do if k ~= "Parent" then o[k] = v end end 57→ for _, c in children or {} do c.Parent = o end 58→ if class == "TextButton" or class == "ImageButton" then o:SetAttribute("UXDone", true) end -- OrnamentUX: hands off 59→ if props.Parent then o.Parent = props.Parent end 60→ return o 61→end 62→local new = K.new 63→function K.corner(r) return new("UICorner", { CornerRadius = r }) end 64→local corner = K.corner 65→-- Own 9-slice for atlas art. Roblox's ScaleType.Slice combined with ImageRectOffset/Size draws the borders from the 66→-- wrong spot on many devices (seams and a "shifted" frame, worst on phones with reduced texture quality), while a 67→-- plain Stretch of an ImageRect is always exact. So a sliced art becomes 9 stretched pieces under the (invisible) 68→-- image: corners keep their size, edges stretch one way, the centre both ways. SliceCenter is relative to the 69→-- art rect (like before); border sizes are in design units (SliceScale x art px) and scale with the window's UIScale. 70→-- The pieces follow the image's ImageColor3 / ImageTransparency / ZIndex / Image / rect (the host's own 71→-- ImageTransparency is remembered in the "ArtTransparency" attribute; the host itself stays fully transparent). 72→local function slice9(img, center, scale) 73→ local holder = Instance.new("Frame") 74→ holder.Name = "Slice9" 75→ holder.BackgroundTransparency = 1 76→ holder.Size = UDim2.fromScale(1, 1) 77→ holder.ZIndex = img.ZIndex 78→ local pieces = {} 79→ local function build() 80→ for _, p in pieces do p:Destroy() end 81→ table.clear(pieces) 82→ local off, size = img.ImageRectOffset, img.ImageRectSize 83→ local L, T = center.Min.X, center.Min.Y 84→ local R, B = size.X - center.Max.X, size.Y - center.Max.Y 85→ local cw, chh = size.X - L - R, size.Y - T - B 86→ local l, t, r, b = L * scale, T * scale, R * scale, B * scale 87→ local E = 1 -- edges / centre reach 1 unit under their neighbours: no hairline gaps between pieces 88→ -- { source x, source w, position, size }; drawn centre -> edges -> corners 89→ local cols = { 90→ { 0, L, UDim.new(0, 0), UDim.new(0, l) }, 91→ { L, cw, UDim.new(0, l - E), UDim.new(1, -l - r + 2 * E) }, 92→ { L + cw, R, UDim.new(1, -r), UDim.new(0, r) }, 93→ } 94→ local rows = { 95→ { 0, T, UDim.new(0, 0), UDim.new(0, t) }, 96→ { T, chh, UDim.new(0, t - E), UDim.new(1, -t - b + 2 * E) }, 97→ { T + chh, B, UDim.new(1, -b), UDim.new(0, b) }, 98→ } 99→ local order = { { 2, 2 }, { 2, 1 }, { 2, 3 }, { 1, 2 }, { 3, 2 }, { 1, 1 }, { 3, 1 }, { 1, 3 }, { 3, 3 } } 100→ for k, cr in order do 101→ local c = cols[cr[1] ] 102→ local rw = rows[cr[2] ] 103→ if c[2] > 0 and rw[2] > 0 then 104→ local p = Instance.new("ImageLabel") 105→ p.Name = "Piece" .. k 106→ p.BackgroundTransparency = 1 107→ p.Image = img.Image 108→ p.ImageRectOffset = off + Vector2.new(c[1], rw[1]) 109→ p.ImageRectSize = Vector2.new(c[2], rw[2]) 110→ p.ScaleType = Enum.ScaleType.Stretch 111→ p.ImageColor3 = img.ImageColor3 112→ p.ImageTransparency = img:GetAttribute("ArtTransparency") or 0 113→ p.Position = UDim2.new(c[3], rw[3]) 114→ p.Size = UDim2.new(c[4], rw[4]) 115→ p.ZIndex = img.ZIndex 116→ p.Parent = holder 117→ table.insert(pieces, p) 118→ end 119→ end 120→ end 121→ build() 122→ img:GetPropertyChangedSignal("ImageColor3"):Connect(function() for _, p in pieces do p.ImageColor3 = img.ImageColor3 end end) 123→ img:GetPropertyChangedSignal("ImageTransparency"):Connect(function() 124→ if img.ImageTransparency == 1 then return end 125→ img:SetAttribute("ArtTransparency", img.ImageTransparency) 126→ for _, p in pieces do p.ImageTransparency = img.ImageTransparency end 127→ img.ImageTransparency = 1 128→ end) 129→ img:GetPropertyChangedSignal("ZIndex"):Connect(function() holder.ZIndex = img.ZIndex; for _, p in pieces do p.ZIndex = img.ZIndex end end) 130→ for _, prop in { "Image", "ImageRectOffset", "ImageRectSize" } do img:GetPropertyChangedSignal(prop):Connect(build) end 131→ img.ImageTransparency = 1 132→ holder.Parent = img 133→end 134→function K.art(name, props, isButton) 135→ local d = ART[name] 136→ props.BackgroundTransparency = 1 137→ props.Image = d[1] 138→ if d[2] then 139→ props.ImageRectOffset = Vector2.new(d[2][1], d[2][2]) 140→ props.ImageRectSize = Vector2.new(d[2][3], d[2][4]) 141→ end 142→ local sliced = d[2] ~= nil and props.ScaleType == Enum.ScaleType.Slice 143→ local center, scale, transp = props.SliceCenter, props.SliceScale or 1, props.ImageTransparency 144→ if sliced then props.ScaleType, props.SliceCenter, props.SliceScale = Enum.ScaleType.Stretch, nil, nil end 145→ local o = new(isButton and "ImageButton" or "ImageLabel", props) 146→ if sliced then 147→ if transp then o:SetAttribute("ArtTransparency", transp) end 148→ slice9(o, center, scale) 149→ end 150→ return o 151→end 152→local art = K.art 153→function K.setArt(img, name) 154→ local d = ART[name] 155→ img.Image = d[1] 156→ img.ImageRectOffset = Vector2.new(d[2][1], d[2][2]) 157→ img.ImageRectSize = Vector2.new(d[2][3], d[2][4]) 158→end 159→local setArt = K.setArt 160→-- rounded title text with a thin black outline 161→function K.label(props, stroke) 162→ props.BackgroundTransparency = 1 163→ props.FontFace = props.FontFace or FONT 164→ props.TextColor3 = props.TextColor3 or WHITE 165→ if props.TextXAlignment == nil then props.TextXAlignment = Enum.TextXAlignment.Left end 166→ local t = new("TextLabel", props) 167→ new("UIStroke", { Color = INK, Thickness = stroke or 2, Parent = t }) 168→ return t 169→end 170→local label = K.label 171→function K.maxText(t, size) new("UITextSizeConstraint", { MaxTextSize = size, Parent = t }) return t end 172→local maxText = K.maxText 173→function K.isPress(input) 174→ return input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch 175→end 176→local isPress = K.isPress 177→-- floating "+1" over a card 178→function K.floatText(parent, text, color) 179→ local t = label({ AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.45), Size = UDim2.fromOffset(300, 60), 180→ Text = text, TextSize = 48, TextColor3 = color or OK, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 40, Parent = parent }, 3) 181→ local sc = new("UIScale", { Scale = 0.6, Parent = t }) 182→ tween(sc, 0.25, { Scale = 1 }, Enum.EasingStyle.Back) 183→ tween(t, 1.1, { Position = UDim2.fromScale(0.5, 0.05), TextTransparency = 1 }) 184→ tween(t.UIStroke, 1.1, { Transparency = 1 }) 185→ task.delay(1.15, function() t:Destroy() end) 186→end 187→function K.flash(card, radius) 188→ local f = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, BackgroundTransparency = 0.45, ZIndex = 39, Parent = card }, { corner(UDim.new(0, radius or 30)) }) 189→ tween(f, 0.5, { BackgroundTransparency = 1 }) 190→ task.delay(0.55, function() f:Destroy() end) 191→end 192→-- vertical scrolling list / grid 193→function K.scroll(parent, pos, size, layout) 194→ local s = new("ScrollingFrame", { Position = pos, Size = size, BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 10, ZIndex = 4, 195→ ScrollBarImageColor3 = GOLD, AutomaticCanvasSize = Enum.AutomaticSize.Y, CanvasSize = UDim2.new(), ScrollingDirection = Enum.ScrollingDirection.Y, Parent = parent }) 196→ if layout then layout.Parent = s end 197→ return s 198→end 199→-- gift + title + hint (+ optional button) for an empty list 200→function K.emptyState(props, title, hint) 201→ local f = new("Frame", props) 202→ f.BackgroundTransparency = 1 203→ f.Parent = props.Parent 204→ art("gift", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 10), Size = UDim2.fromOffset(170, 170), ScaleType = Enum.ScaleType.Fit, ZIndex = 5, Parent = f }) 205→ maxText(label({ Position = UDim2.new(0, 40, 0, 190), Size = UDim2.new(1, -80, 0, 50), Text = title, TextScaled = true, 206→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 5, Parent = f }, 3), 42) 207→ maxText(label({ Position = UDim2.new(0, 40, 0, 246), Size = UDim2.new(1, -80, 0, 60), Text = hint, TextScaled = true, TextWrapped = true, FontFace = BODY, 208→ TextColor3 = SOFT, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 5, Parent = f }, 1.5), 26) 209→ return f 210→end 211→ 212→-- links between windows: OrnamentCraftUI registers K.nav. = function(tabId) ... end 213→K.nav = {} 214→function K.go(window, tab) 215→ local f = K.nav[window] 216→ if f then f(tab) end 217→end 218→ 219→-- the toy's 3D model in a square ViewportFrame (transparent background); same interface as the old pattern icon: 220→-- returns the GuiObject, the caller sets AnchorPoint / Position / ZIndex 221→local ToyModels 222→function K.toyIcon(item, size, parent) 223→ ToyModels = ToyModels or require(game:GetService("ReplicatedStorage"):WaitForChild("OrnamentMachine"):WaitForChild("ToyModels")) 224→ local vp = Instance.new("ViewportFrame") 225→ vp.Name = "ToyIcon" 226→ vp.BackgroundTransparency = 1 227→ vp.Size = UDim2.fromOffset(size, size) 228→ vp.Ambient = Color3.fromRGB(170, 170, 185) 229→ vp.LightColor = Color3.fromRGB(255, 245, 230) 230→ vp.LightDirection = Vector3.new(-1, -1.3, -1) 231→ local ok, model = pcall(ToyModels.Build, item, 1) 232→ if ok and model then 233→ model:PivotTo(CFrame.Angles(0, math.rad(20), 0)) 234→ model.Parent = vp 235→ end 236→ local cam = Instance.new("Camera") 237→ cam.FieldOfView = 30 238→ cam.CFrame = CFrame.lookAt(Vector3.new(0, 0.2, 3.3), Vector3.new(0, 0, 0)) 239→ cam.Parent = vp 240→ vp.CurrentCamera = cam 241→ vp.Parent = parent 242→ return vp 243→end 244→ 245→-- a crafted item (Config.CRAFTS id) as its 3D model in a square ViewportFrame (Decor template); same interface 246→-- as K.toyIcon. The model is cloned after its meshes loaded. 247→K.CRAFT_COLOR = Color3.fromRGB(255, 170, 60) 248→-- turns a crafted model so its front/side faces the camera (yaw 90: the train centred at the front, engine three-quarter view) 249→-- and fills the view with it (the ring of the train's Track, seen from ~30 degrees up, slightly cropped) 250→K.CRAFT_YAW = 90 251→function K.frameCraft(model, cam, angle, aspect) 252→ local track = model:FindFirstChild("Track") 253→ if not track then 254→ -- other crafted items (front = +Z): three-quarter front view, whole item in the frame 255→ model:PivotTo(CFrame.Angles(0, math.rad(-22), 0)) 256→ local cf, sz = model:GetBoundingBox() 257→ cam.FieldOfView = 30 258→ local fitV = (sz.Y / 2 + 0.15 * sz.Y) / math.tan(math.rad(15)) 259→ local fitW = (math.max(sz.X, sz.Z) / 2 * 1.15) / (math.tan(math.rad(15)) * math.min(aspect or 1, 1.4)) 260→ local up = math.rad(14) 261→ local dir = Vector3.new(0, math.sin(up), math.cos(up)) 262→ cam.CFrame = CFrame.lookAt(cf.Position + dir * (math.max(fitV, fitW) + math.max(sz.X, sz.Z) / 2), cf.Position) 263→ return 264→ end 265→ model:PivotTo(CFrame.Angles(0, math.rad(angle or K.CRAFT_YAW), 0)) 266→ local cf, sz = (track or model):GetBoundingBox() 267→ local centre = cf.Position 268→ local D = math.max(sz.X, sz.Z) 269→ cam.FieldOfView = 30 270→ local up = math.rad(30) 271→ local dir = Vector3.new(0, math.sin(up), math.cos(up)) 272→ -- fit the ring's width (horizontal FOV grows with the view's width / height) and its height (~half the ring + engine) 273→ local tanV = math.tan(math.rad(15)) 274→ local distW = (D / 2) / (tanV * (aspect or 1)) * 0.7 275→ local distH = (D * math.sin(up) / 2 * 0.7 + 1.6) / tanV 276→ local dist = math.max(distW, distH) 277→ local target = centre + Vector3.new(0, 0.9, D * 0.22) -- towards the camera: the train in front fills the view, the far rails crop 278→ cam.CFrame = CFrame.lookAt(target + dir * dist, target) 279→end 280→function K.craftIcon(id, size, parent, angle) 281→ local RS = game:GetService("ReplicatedStorage") 282→ local folder = RS:WaitForChild("OrnamentMachine") 283→ local Config = require(folder:WaitForChild("Config")) 284→ local vp = Instance.new("ViewportFrame") 285→ vp.Name = "CraftIcon" 286→ vp.BackgroundTransparency = 1 287→ vp.Size = UDim2.fromOffset(size, size) 288→ vp.Ambient = Color3.fromRGB(175, 175, 190) 289→ vp.LightColor = Color3.fromRGB(255, 245, 230) 290→ vp.LightDirection = Vector3.new(-1, -1.3, -1) 291→ local cam = Instance.new("Camera") 292→ cam.FieldOfView = 32 293→ cam.Parent = vp 294→ vp.CurrentCamera = cam 295→ vp.Parent = parent 296→ local shop = Config.ShopById[id] 297→ local template = shop and folder:WaitForChild("Decor"):FindFirstChild(shop.Model) 298→ if template then 299→ task.spawn(function() 300→ pcall(function() game:GetService("ContentProvider"):PreloadAsync({ template }) end) 301→ if not vp.Parent then return end 302→ local m = template:Clone() 303→ m:RemoveTag("TrainRide") -- a still picture (TrainRide drives tagged models) 304→ for _, d in m:GetDescendants() do 305→ if d:IsA("ParticleEmitter") or d:IsA("Light") or d:IsA("Sound") then d:Destroy() end 306→ end 307→ m.Parent = vp 308→ local a = vp.AbsoluteSize 309→ K.frameCraft(m, cam, angle, (a.X > 0 and a.Y > 0) and a.X / a.Y or 1) 310→ end) 311→ end 312→ return vp 313→end 314→ 315→---------------------------------------------------------------- hover tooltip 316→-- K.tooltip(guiObject, getText): while the mouse is over the object a small dark card with getText() (rich text) 317→-- follows the cursor. Lives in its own ScreenGui on top of everything; hides when the object goes away. 318→local tipGui, tipLabel, tipOwner, tipConn 319→local function tipHide(owner) 320→ if owner and tipOwner ~= owner then return end 321→ tipOwner = nil 322→ if tipGui then tipGui.Enabled = false end 323→ if tipConn then tipConn:Disconnect(); tipConn = nil end 324→end 325→local function tipPlace() 326→ local UIS = game:GetService("UserInputService") 327→ local m = UIS:GetMouseLocation() 328→ local vp = workspace.CurrentCamera.ViewportSize 329→ local s = tipLabel.AbsoluteSize 330→ local x, y = m.X + 18, m.Y + 18 331→ if x + s.X > vp.X - 6 then x = m.X - s.X - 12 end 332→ if y + s.Y > vp.Y - 6 then y = m.Y - s.Y - 12 end 333→ tipLabel.Position = UDim2.fromOffset(x, y) 334→end 335→function K.tooltip(obj, getText) 336→ local function show() 337→ local pg = game:GetService("Players").LocalPlayer:FindFirstChildOfClass("PlayerGui") 338→ if not pg then return end 339→ if not tipGui or not tipGui.Parent then 340→ tipGui = new("ScreenGui", { Name = "KTooltip", DisplayOrder = 200, IgnoreGuiInset = true, ResetOnSpawn = false, Enabled = false, Parent = pg }) 341→ tipLabel = new("TextLabel", { AutomaticSize = Enum.AutomaticSize.XY, Size = UDim2.fromOffset(0, 0), BackgroundColor3 = Color3.fromRGB(12, 20, 40), 342→ BackgroundTransparency = 0.05, RichText = true, TextWrapped = false, FontFace = BODY, TextSize = 21, TextColor3 = WHITE, 343→ TextXAlignment = Enum.TextXAlignment.Left, Text = "", ZIndex = 10, Parent = tipGui }, { 344→ corner(UDim.new(0, 10)), new("UIStroke", { Color = GOLD, Thickness = 2, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }), 345→ new("UIPadding", { PaddingLeft = UDim.new(0, 12), PaddingRight = UDim.new(0, 12), PaddingTop = UDim.new(0, 8), PaddingBottom = UDim.new(0, 8) }), 346→ }) 347→ end 348→ local ok, t = pcall(getText) 349→ if not ok or not t or t == "" then return end 350→ tipLabel.Text = t 351→ tipOwner = obj 352→ tipGui.Enabled = true 353→ tipPlace() 354→ if tipConn then tipConn:Disconnect() end 355→ tipConn = game:GetService("RunService").RenderStepped:Connect(function() 356→ if not obj.Parent or not obj.Visible or not obj:IsDescendantOf(game) then tipHide(obj) return end 357→ local sg = obj:FindFirstAncestorOfClass("ScreenGui") 358→ if sg and not sg.Enabled then tipHide(obj) return end 359→ tipPlace() 360→ end) 361→ end 362→ obj.MouseEnter:Connect(show) 363→ obj.MouseLeave:Connect(function() tipHide(obj) end) 364→ obj.Destroying:Connect(function() tipHide(obj) end) 365→end 366→-- tooltip text of a toy: name, tier · rarity (· variant) 367→function K.toyTip(Config, it, extra) 368→ local toy, r = Config.ToyById[it.Toy], Config.RarityById[it.Rarity] 369→ if not toy or not r then return "" end 370→ local v = it.Variant and Config.VariantById[it.Variant] 371→ local function hex(c) return string.format("#%02X%02X%02X", c.R * 255, c.G * 255, c.B * 255) end 372→ local t = "" .. toy.Name .. "\n" .. r.Name .. " · " .. Config.TIERS[toy.Tier].Name 373→ if v then t ..= " · " .. v.Name .. "" end 374→ if extra then t ..= "\n" .. extra end 375→ return t 376→end 377→ 378→-- toy tile (button): dark rounded square, the toy's model on a disc, name, rarity line, optional value line. 379→-- o = { Config, miniPattern, parent, item, w, h, order, z, value } -> { button, stroke, scale, setSelected, lock } 380→function K.toyTile(o) 381→ local Config = o.Config 382→ local it = o.item 383→ local r = Config.RarityById[it.Rarity] 384→ local v = it.Variant and Config.VariantById[it.Variant] 385→ local z = o.z or 5 386→ local edge = v and v.Color or r.Color 387→ local b = new("TextButton", { Text = "", AutoButtonColor = false, BackgroundColor3 = Color3.fromRGB(10, 26, 34), Size = UDim2.fromOffset(o.w, o.h), 388→ LayoutOrder = o.order or 0, ZIndex = z, Parent = o.parent }, { corner(UDim.new(0, 18)) }) 389→ local st = new("UIStroke", { Color = edge, Thickness = 2.5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border, Parent = b }) 390→ local sc = new("UIScale", { Parent = b }) 391→ local d = math.floor(math.min(o.w * 0.66, o.h * 0.52)) 392→ local disc = new("Frame", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 6), Size = UDim2.fromOffset(d, d), BackgroundColor3 = Color3.new(0, 0, 0), 393→ BackgroundTransparency = 0.4, ZIndex = z + 1, Parent = b }, { corner(UDim.new(0.5, 0)) }) 394→ local mini = K.toyIcon(it, math.floor(d * 0.92), disc) 395→ mini.AnchorPoint = Vector2.new(0.5, 0.5) 396→ mini.Position = UDim2.fromScale(0.5, 0.5) 397→ mini.ZIndex = z + 2 398→ for _, x in mini:GetDescendants() do if x:IsA("GuiObject") then x.ZIndex = z + 2 end end 399→ local y = d + 8 400→ local lineH = math.floor((o.h - y - 4) / (o.value and 3 or 2)) 401→ maxText(label({ Position = UDim2.fromOffset(4, y), Size = UDim2.new(1, -8, 0, lineH), Text = Config.ToyById[it.Toy].Name, TextScaled = true, 402→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 22) 403→ maxText(label({ Position = UDim2.fromOffset(4, y + lineH), Size = UDim2.new(1, -8, 0, lineH), Text = r.Name .. (v and (" · " .. v.Name) or ""), TextScaled = true, 404→ TextColor3 = edge, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 18) 405→ if o.value then 406→ maxText(label({ Position = UDim2.fromOffset(4, y + lineH * 2), Size = UDim2.new(1, -8, 0, lineH), Text = o.valueText or (Config.Value(it) .. " shards"), TextScaled = true, FontFace = BODY, 407→ TextColor3 = Color3.fromRGB(190, 225, 255), TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = b }, 1.5), 16) 408→ end 409→ K.tooltip(b, function() return K.toyTip(Config, it) end) 410→ local t = { button = b, stroke = st, scale = sc, selected = false, locked = false, inert = o.inert } 411→ local function paint(hover, down) 412→ st.Color = t.selected and GOLD or edge 413→ st.Thickness = t.selected and 5 or 2.5 414→ local live = not t.locked and not t.inert 415→ tween(sc, 0.12, { Scale = (down and live) and 0.94 or (hover and live) and 1.06 or t.selected and 1.04 or 1 }, Enum.EasingStyle.Back) 416→ end 417→ function t.setSelected(v2) t.selected = v2; paint() end 418→ function t.lock(text) 419→ t.locked = true 420→ local f = new("Frame", { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.12, ZIndex = z + 5, Parent = b }, { corner(UDim.new(0, 18)) }) 421→ maxText(label({ Position = UDim2.fromScale(0.06, 0.2), Size = UDim2.fromScale(0.88, 0.6), Text = text, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 6, Parent = f }, 2), 24) 422→ end 423→ function t.wiggle() 424→ tween(b, 0.05, { Rotation = -4 }).Completed:Wait() 425→ tween(b, 0.07, { Rotation = 4 }).Completed:Wait() 426→ tween(b, 0.06, { Rotation = 0 }) 427→ end 428→ local hover = false 429→ b.MouseEnter:Connect(function() hover = true; paint(true) end) 430→ b.MouseLeave:Connect(function() hover = false; paint(false) end) 431→ b.InputBegan:Connect(function(i) if isPress(i) then paint(hover, true) end end) 432→ b.InputEnded:Connect(function(i) if isPress(i) then paint(hover) end end) 433→ return t 434→end 435→ 436→---------------------------------------------------------------- pill button with states 437→local ART_FOR = { ready = "gold", alt = "blue", info = "blue", confirm = "red", danger = "red", done = "green", off = "grey", busy = "grey" } 438→local LIVE = { ready = true, alt = true, confirm = true, danger = true } 439→function K.pill(parent, props, onClick) 440→ local textMax = props.TextMax or 32 441→ props.TextMax = nil 442→ props.AutoButtonColor = false 443→ local b = art("gold", props, true) 444→ b.Parent = parent 445→ local p, z = b.Position, b.Size 446→ b.AnchorPoint = Vector2.new(0.5, 0.5) 447→ b.Position = p + UDim2.new(z.X.Scale / 2, z.X.Offset / 2, z.Y.Scale / 2, z.Y.Offset / 2) 448→ local sc = new("UIScale", { Parent = b }) 449→ local ring = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.new(1, 4, 1, 4), 450→ BackgroundTransparency = 1, ZIndex = 1, Parent = b }, { corner(UDim.new(0.5, 0)) }) 451→ local ringStroke = new("UIStroke", { Color = Color3.fromRGB(255, 240, 180), Thickness = 4, Transparency = 1, Parent = ring }) 452→ local cap = maxText(label({ Position = UDim2.fromScale(0.08, 0.16), Size = UDim2.fromScale(0.84, 0.62), Text = "", TextScaled = true, 453→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = (props.ZIndex or 1) + 1, Parent = b }, 2.5), textMax) 454→ local o = { button = b, state = "ready", hover = false } 455→ local dots 456→ local function paint() 457→ local s = o.state 458→ setArt(b, ART_FOR[s] or "gold") 459→ local live = LIVE[s] == true 460→ b.ImageColor3 = (o.down and live) and Color3.fromRGB(205, 205, 205) or WHITE 461→ cap.TextColor3 = s == "off" and Color3.fromRGB(214, 220, 226) or WHITE 462→ cap.Position = UDim2.fromScale(0.08, (o.down and live) and 0.2 or 0.16) 463→ ringStroke.Transparency = (o.hover and live) and 0.15 or 1 464→ local target = not live and 1 or o.down and 0.94 or o.hover and 1.05 or 1 465→ tween(sc, o.down and 0.07 or 0.14, { Scale = target }, o.down and Enum.EasingStyle.Quad or Enum.EasingStyle.Back) 466→ end 467→ function o.set(state, caption) 468→ if caption then cap.Text = caption end 469→ if state == o.state and state ~= "busy" then paint() return end 470→ if state == "busy" and o.state == "busy" then return end 471→ o.state = state 472→ b.Active = LIVE[state] == true 473→ b.Selectable = b.Active 474→ if state == "busy" then 475→ local my = {} 476→ dots = my 477→ task.spawn(function() 478→ local n = 0 479→ while dots == my and o.state == "busy" do 480→ n = n % 3 + 1 481→ cap.Text = string.rep("•", n) 482→ task.wait(0.25) 483→ end 484→ end) 485→ else 486→ dots = nil 487→ end 488→ paint() 489→ end 490→ function o.wiggle() 491→ tween(b, 0.05, { Rotation = -3 }).Completed:Wait() 492→ tween(b, 0.07, { Rotation = 3 }).Completed:Wait() 493→ tween(b, 0.06, { Rotation = 0 }) 494→ end 495→ b.MouseEnter:Connect(function() o.hover = true; paint() end) 496→ b.MouseLeave:Connect(function() o.hover, o.down = false, false; paint() end) 497→ b.SelectionGained:Connect(function() o.hover = true; paint() end) 498→ b.SelectionLost:Connect(function() o.hover = false; paint() end) 499→ b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; paint() end end) 500→ b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; paint() end end) 501→ b.Activated:Connect(function() 502→ if LIVE[o.state] then 503→ onClick(o.state) 504→ elseif o.state == "off" then 505→ o.wiggle() -- "can't" 506→ end 507→ end) 508→ paint() 509→ return o 510→end 511→ 512→---------------------------------------------------------------- filter chip (green; gold when selected) 513→function K.chip(parent, props, text, onClick, dot) 514→ props.AutoButtonColor = false 515→ local b = art("green", props, true) 516→ b.Parent = parent 517→ local sc = new("UIScale", { Parent = b }) 518→ local z = (props.ZIndex or 4) + 1 519→ local x0 = 0.1 520→ if dot then 521→ new("Frame", { AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0.08, 0, 0.47, 0), Size = UDim2.fromOffset(18, 18), BackgroundColor3 = dot, ZIndex = z, Parent = b }, 522→ { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = INK, Thickness = 2 }) }) 523→ x0 = 0.2 524→ end 525→ local cap = maxText(label({ Position = UDim2.fromScale(x0, 0.18), Size = UDim2.fromScale(0.92 - x0, 0.58), Text = text, TextScaled = true, 526→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z, Parent = b }, 2), 24) 527→ local o = { button = b, selected = false, hover = false, down = false } 528→ local function paint() 529→ setArt(b, o.selected and "gold" or "green") 530→ b.ImageColor3 = o.down and Color3.fromRGB(205, 205, 205) or WHITE 531→ cap.TextColor3 = o.selected and WHITE or Color3.fromRGB(236, 248, 238) 532→ tween(sc, 0.12, { Scale = o.down and 0.95 or (o.hover or o.selected) and 1.04 or 1 }, Enum.EasingStyle.Back) 533→ end 534→ function o.setSelected(v) o.selected = v; paint() end 535→ b.MouseEnter:Connect(function() o.hover = true; paint() end) 536→ b.MouseLeave:Connect(function() o.hover, o.down = false, false; paint() end) 537→ b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; paint() end end) 538→ b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; paint() end end) 539→ b.Activated:Connect(function() onClick() end) 540→ paint() 541→ return o 542→end 543→ 544→-- price plate: crystal + number (orange when you can not afford it) 545→function K.pricePlate(parent, pos, size, z) 546→ z = z or 3 547→ local f = new("Frame", { Position = pos, Size = size, BackgroundColor3 = NAVY, BackgroundTransparency = 0.1, ZIndex = z, Parent = parent }, { 548→ corner(UDim.new(0.5, 0)), new("UIStroke", { Color = Color3.fromRGB(190, 225, 255), Thickness = 2 }), 549→ }) 550→ art("crystal", { Position = UDim2.new(0, -10, 0.5, -30), Size = UDim2.fromOffset(60, 60), ZIndex = z + 1, Parent = f }) 551→ local t = maxText(label({ Position = UDim2.new(0, 52, 0, 4), Size = UDim2.new(1, -62, 1, -8), Text = "", TextScaled = true, 552→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = z + 1, Parent = f }, 2), 32) 553→ return f, t 554→end 555→ 556→---------------------------------------------------------------- window frame + tabs 557→-- opts: win, title, subtitle, tabs = { { id, text, icon, tip } }, closeWindow, fmtNum, onTab(id) 558→K.AREA_POS, K.AREA_SIZE = UDim2.fromOffset(70, 346), UDim2.fromOffset(1260, 566) 559→function K.chrome(opts) 560→ local win = opts.win 561→ local panel = win.panel 562→ local WIDTH, HEIGHT = 1400, 1000 563→ win.w, win.h = WIDTH, HEIGHT 564→ panel.Size = UDim2.fromOffset(WIDTH, HEIGHT) 565→ panel.BackgroundTransparency = 1 566→ for _, c in panel:GetChildren() do 567→ if c:IsA("UIStroke") then c.Enabled = false end 568→ if c:IsA("Frame") then c.Visible = false end -- makeWindow's title bar 569→ end 570→ local fmt = opts.fmtNum 571→ 572→ local bg = new("Frame", { Name = "Bg", Size = UDim2.fromScale(1, 1), BackgroundColor3 = WHITE, ZIndex = 0, Parent = panel }, { 573→ corner(UDim.new(0, 44)), 574→ new("UIGradient", { Rotation = 90, Color = ColorSequence.new(Color3.fromRGB(22, 84, 70), Color3.fromRGB(8, 36, 44)) }), 575→ new("UIStroke", { Name = "GoldEdge", Color = Color3.fromRGB(242, 196, 82), Thickness = 5 }), 576→ }) 577→ new("Frame", { Position = UDim2.fromOffset(12, 12), Size = UDim2.new(1, -24, 1, -24), BackgroundTransparency = 1, ZIndex = 0, Parent = bg }, { 578→ corner(UDim.new(0, 36)), new("UIStroke", { Color = GOLD, Thickness = 2, Transparency = 0.55 }), 579→ }) 580→ -- twinkling stars in the header sky 581→ local rng = Random.new(7) 582→ for _ = 1, 26 do 583→ local s = rng:NextInteger(3, 7) 584→ local star = new("Frame", { Position = UDim2.fromOffset(rng:NextInteger(40, 1360), rng:NextInteger(24, 190)), Size = UDim2.fromOffset(s, s), 585→ BackgroundColor3 = WHITE, BackgroundTransparency = rng:NextNumber(0.2, 0.6), ZIndex = 1, Parent = panel }, { corner(UDim.new(0.5, 0)) }) 586→ local delay0 = rng:NextNumber(0, 3) 587→ task.spawn(function() 588→ task.wait(delay0) 589→ while star.Parent do 590→ tween(star, 1.4, { BackgroundTransparency = 0.85 }, Enum.EasingStyle.Sine).Completed:Wait() 591→ tween(star, 1.4, { BackgroundTransparency = 0.2 }, Enum.EasingStyle.Sine).Completed:Wait() 592→ end 593→ end) 594→ end 595→ art("garland", { Position = UDim2.fromOffset(20, -70), Size = UDim2.fromOffset(330, 330), ScaleType = Enum.ScaleType.Fit, ZIndex = 2, Parent = panel }) 596→ art("garland", { Position = UDim2.fromOffset(1050, -70), Size = UDim2.fromOffset(330, 330), ScaleType = Enum.ScaleType.Fit, ZIndex = 2, Parent = panel }) 597→ 598→ -- ribbon title + subtitle 599→ local ribbon = art("ribbon", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.fromOffset(WIDTH / 2, -22), Size = UDim2.fromOffset(480, 271), ZIndex = 3, Parent = panel }) 600→ maxText(label({ Position = UDim2.fromScale(0.14, 0.5), Size = UDim2.fromScale(0.72, 0.25), Text = opts.title, TextScaled = true, 601→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = ribbon }, 3.5), 64) 602→ maxText(label({ Position = UDim2.fromOffset(60, 132), Size = UDim2.fromOffset(330, 56), Text = opts.subtitle or "", TextScaled = true, 603→ TextColor3 = SOFT, FontFace = BODY, ZIndex = 3, Parent = panel }, 1.5), 24) 604→ 605→ -- balance plate (animated count) 606→ local balance = art("blue", { Position = UDim2.fromOffset(1000, 120), Size = UDim2.fromOffset(250, 84), ZIndex = 3, Parent = panel }) 607→ art("crystal", { Position = UDim2.fromOffset(-26, -10), Size = UDim2.fromOffset(100, 100), ZIndex = 4, Parent = balance }) 608→ local balanceText = maxText(label({ Position = UDim2.fromOffset(72, 12), Size = UDim2.new(1, -90, 1, -24), Text = "0", TextScaled = true, 609→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = balance }, 3), 40) 610→ local lastShown = 0 611→ local function setBalance(v, instant) 612→ local from = lastShown 613→ lastShown = v 614→ if instant or from == v or not win.overlay.Visible then balanceText.Text = fmt(v) return end 615→ local nv = Instance.new("NumberValue") 616→ nv.Value = from 617→ nv.Changed:Connect(function(x) balanceText.Text = fmt(x) end) 618→ tween(nv, 0.45, { Value = v }).Completed:Connect(function() balanceText.Text = fmt(v); nv:Destroy() end) 619→ end 620→ 621→ -- close: drawn in code (red glossy square, gold rim, snow cap, "X"; Fredoka has no ✕ glyph) 622→ local close = new("TextButton", { Name = "Close", AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(1320, 92), Size = UDim2.fromOffset(96, 96), Text = "", 623→ BackgroundColor3 = Color3.fromRGB(214, 36, 46), AutoButtonColor = false, ZIndex = 5, Parent = panel }, { 624→ corner(UDim.new(0, 24)), 625→ new("UIStroke", { Color = GOLD, Thickness = 5, ApplyStrokeMode = Enum.ApplyStrokeMode.Border }), 626→ }) 627→ new("Frame", { AnchorPoint = Vector2.new(0.5, 0), Position = UDim2.new(0.5, 0, 0, 6), Size = UDim2.new(1, -16, 0.4, 0), BackgroundColor3 = WHITE, 628→ BackgroundTransparency = 0.8, ZIndex = 6, Parent = close }, { corner(UDim.new(0, 18)), new("UIGradient", { Rotation = 90, Transparency = NumberSequence.new(0.1, 1) }) }) 629→ new("Frame", { Position = UDim2.new(0, -6, 0, -12), Size = UDim2.new(1, 12, 0, 24), BackgroundColor3 = Color3.fromRGB(245, 250, 255), ZIndex = 8, Parent = close }, { 630→ corner(UDim.new(0.5, 0)), new("UIGradient", { Rotation = 90, Color = ColorSequence.new(WHITE, Color3.fromRGB(205, 222, 240)) }), 631→ }) 632→ label({ Position = UDim2.fromScale(0.14, 0.16), Size = UDim2.fromScale(0.72, 0.72), Text = "X", TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 7, Parent = close }, 3) 633→ local closeScale = new("UIScale", { Parent = close }) 634→ close.MouseEnter:Connect(function() tween(closeScale, 0.14, { Scale = 1.08 }, Enum.EasingStyle.Back); tween(close, 0.14, { Rotation = 6 }) end) 635→ close.MouseLeave:Connect(function() tween(closeScale, 0.14, { Scale = 1 }); tween(close, 0.14, { Rotation = 0 }) end) 636→ close.InputBegan:Connect(function(i) if isPress(i) then tween(closeScale, 0.06, { Scale = 0.92 }) end end) 637→ close.Activated:Connect(function() opts.closeWindow() end) 638→ 639→ -- content panel + footer tip 640→ art("panel", { Position = UDim2.fromOffset(40, 300), Size = UDim2.fromOffset(1320, 632), ScaleType = Enum.ScaleType.Slice, 641→ SliceCenter = Rect.new(60, 70, 218, 180), ZIndex = 2, Parent = panel }) 642→ art("holly", { Position = UDim2.fromOffset(1262, 262), Size = UDim2.fromOffset(130, 130), ScaleType = Enum.ScaleType.Fit, ZIndex = 6, Parent = panel }) 643→ art("gift", { Position = UDim2.fromOffset(-34, 850), Size = UDim2.fromOffset(150, 150), ScaleType = Enum.ScaleType.Fit, ZIndex = 6, Parent = panel }) 644→ local tip = maxText(label({ Position = UDim2.fromOffset(130, 940), Size = UDim2.fromOffset(1140, 44), Text = "", TextScaled = true, FontFace = BODY, 645→ TextColor3 = SOFT, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 3, Parent = panel }, 1.5), 26) 646→ 647→ -- pages: a CanvasGroup each (fade + slide on switch) 648→ local AREA_POS, AREA_SIZE = K.AREA_POS, K.AREA_SIZE 649→ local pages = {} 650→ local function makePage(id, withScroll) 651→ local g = new("CanvasGroup", { Name = "Page" .. id, Position = AREA_POS, Size = AREA_SIZE, BackgroundTransparency = 1, Visible = false, ZIndex = 4, Parent = panel }) 652→ pages[id] = { group = g } 653→ if withScroll then 654→ return g, K.scroll(g, UDim2.new(), UDim2.fromScale(1, 1)) 655→ end 656→ return g 657→ end 658→ 659→ -- tabs 660→ local tabs, current = {}, nil 661→ local self = { panel = panel, tabs = tabs, makePage = makePage, setBalance = setBalance, tip = tip } 662→ local startX = math.floor((WIDTH - (#opts.tabs * 300 + (#opts.tabs - 1) * 22)) / 2) 663→ for i, t in opts.tabs do 664→ local x = startX + (i - 1) * 322 665→ local b = art("green", { Name = "Tab" .. t.id, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromOffset(x + 150, 258), Size = UDim2.fromOffset(300, 96), 666→ AutoButtonColor = false, ZIndex = 3, Parent = panel }, true) 667→ local sc = new("UIScale", { Parent = b }) 668→ local ring = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.new(1, 4, 1, 4), BackgroundTransparency = 1, Parent = b }, { corner(UDim.new(0.5, 0)) }) 669→ local ringStroke = new("UIStroke", { Color = Color3.fromRGB(255, 240, 180), Thickness = 4, Transparency = 1, Parent = ring }) 670→ label({ Position = UDim2.fromScale(0.07, 0.17), Size = UDim2.fromScale(0.2, 0.62), Text = t.icon, TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = b }, 0) 671→ local cap = maxText(label({ Position = UDim2.fromScale(0.27, 0.17), Size = UDim2.fromScale(0.66, 0.6), Text = t.text, TextScaled = true, 672→ TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 4, Parent = b }, 2.5), 34) 673→ local badge = new("Frame", { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(1, -18, 0, 10), Size = UDim2.fromOffset(46, 46), 674→ BackgroundColor3 = Color3.fromRGB(226, 40, 52), Visible = false, ZIndex = 6, Parent = b }, { corner(UDim.new(0.5, 0)), new("UIStroke", { Color = WHITE, Thickness = 3 }) }) 675→ local badgeText = label({ Size = UDim2.fromScale(1, 1), Text = "", TextScaled = true, TextXAlignment = Enum.TextXAlignment.Center, ZIndex = 7, Parent = badge }, 1.5) 676→ new("UIPadding", { PaddingTop = UDim.new(0.2, 0), PaddingBottom = UDim.new(0.2, 0), PaddingLeft = UDim.new(0.15, 0), PaddingRight = UDim.new(0.15, 0), Parent = badge }) 677→ local badgeScale = new("UIScale", { Parent = badge }) 678→ local o = { button = b, hover = false, down = false, count = 0 } 679→ function o.paint() 680→ local sel = current == t.id 681→ setArt(b, sel and "red" or "green") 682→ b.ImageColor3 = (o.down and not sel) and Color3.fromRGB(205, 205, 205) or WHITE 683→ cap.TextColor3 = sel and WHITE or Color3.fromRGB(236, 248, 238) 684→ ringStroke.Transparency = (o.hover and not sel) and 0.2 or 1 685→ b.Position = UDim2.fromOffset(x + 150, sel and 252 or 258) 686→ tween(sc, 0.14, { Scale = o.down and 0.95 or sel and 1.07 or o.hover and 1.04 or 1 }, Enum.EasingStyle.Back) 687→ end 688→ function o.setBadge(n) 689→ badge.Visible = n > 0 690→ badgeText.Text = n > 9 and "9+" or tostring(n) 691→ if n > o.count then 692→ badgeScale.Scale = 1.5 693→ tween(badgeScale, 0.3, { Scale = 1 }, Enum.EasingStyle.Back) 694→ end 695→ o.count = n 696→ end 697→ b.MouseEnter:Connect(function() o.hover = true; o.paint() end) 698→ b.MouseLeave:Connect(function() o.hover, o.down = false, false; o.paint() end) 699→ b.SelectionGained:Connect(function() o.hover = true; o.paint() end) 700→ b.SelectionLost:Connect(function() o.hover = false; o.paint() end) 701→ b.InputBegan:Connect(function(input) if isPress(input) then o.down = true; o.paint() end end) 702→ b.InputEnded:Connect(function(input) if isPress(input) then o.down = false; o.paint() end end) 703→ b.Activated:Connect(function() self.showTab(t.id) end) 704→ tabs[t.id] = o 705→ end 706→ 707→ function self.current() return current end 708→ function self.showTab(id, force) 709→ if current == id and not force then return end 710→ local prev = current 711→ current = id 712→ for _, t in tabs do t.paint() end 713→ for pid, p in pages do 714→ if pid == id then 715→ p.group.Visible = true 716→ if prev ~= id then 717→ p.group.GroupTransparency = 1 718→ p.group.Position = AREA_POS + UDim2.fromOffset(0, 24) 719→ tween(p.group, 0.22, { GroupTransparency = 0, Position = AREA_POS }) 720→ end 721→ elseif pid == prev then 722→ p.group.Visible = false 723→ end 724→ end 725→ for _, t in opts.tabs do if t.id == id then tip.Text = t.tip; tip.TextColor3 = SOFT end end 726→ if opts.onTab then opts.onTab(id) end 727→ end 728→ return self 729→end 730→ 731→return K 732→