-- Pixel GUI v1.20.7 - Resolve Luau ambiguous IIFE boundaries while retaining register-limit fix -- F3X/BTools texture edits use CreateTextures and SyncTexture on the tool endpoint. -- No bypass of the game server's build permissions or rate limits. -- One-file local GUI: no require(), no HTTP, no third-party loaders. -- Pixel Realm 2: enclosed avatar-themed hall with F3X-synced animated accents and grouped updates. -- The game's server decides which part edits are allowed. -- Decal tools support one part, a selected build, or all editable Workspace parts with capped, cancellable batches. -- Skybox: optional local Lighting preview OR scalable F3X textured-mesh dome. -- F3X Realms: track and remove only previously created RetroF3X scenery in the same server. -- Map Switcher v1.14.1: uses the SAME F3X build workflow as REALMS; no server map manager. -- Music: configurable HD Admin prefix, e.g. ;music or :music, followed by volume and pitch. -- Server decides whether music commands and F3X edits are allowed. -- Configurable delays never bypass server rate limits. local Players = game:GetService('Players') local UIS = game:GetService('UserInputService') local Lighting = game:GetService('Lighting') local SoundService = game:GetService('SoundService') local ReplicatedStorage = game:GetService('ReplicatedStorage') local TextChatService = game:GetService('TextChatService') local player = Players.LocalPlayer if not player then return end local mouse = player:GetMouse() local guiParent = player:WaitForChild('PlayerGui') local oldSphere = guiParent:FindFirstChild('RetroF3X_BarrierRadiusSphere') if oldSphere then oldSphere:Destroy() end local oldGui = guiParent:FindFirstChild('RetroF3X') if oldGui then oldGui:Destroy() end -- Also close a previous Pixel GUI instance when re-running this version. if guiParent:FindFirstChild('PixelGUI') then guiParent.PixelGUI:Destroy() end local oldOutline = guiParent:FindFirstChild('RetroF3X_PartSelection') if oldOutline then oldOutline:Destroy() end local oldSound = SoundService:FindFirstChild('RetroF3X_LocalMusic') if oldSound then oldSound:Destroy() end local GOLD = Color3.fromRGB(233,160,195) -- configurable interface accent local DARK = Color3.fromRGB(43,43,47) local PANEL = Color3.fromRGB(59,59,64) local SOFT = Color3.fromRGB(82,82,87) local WHITE = Color3.fromRGB(241,241,241) local QUIET = Color3.fromRGB(180,180,180) local GREEN = Color3.fromRGB(169,244,169) local AMBER = Color3.fromRGB(235,192,216) local SONGS = { 'theme', 'hood trap beat', 'TrafficConeHax Realm Music', 'khmer jump 2', 'jumpsyle', 'wont stop us', 'spooky scary skeletons', 'Windows Sparta Remix', 'die in a fire', 'hard trance', 'Bomb Hard OL', '1x1x1x1', 'Mosaku', 'rockefeller', 'dubstep gun', 'daisy bell', 'the perfect girl', 'creepy music', 'Mario Paint Theme', 'AWP', 'can-can', 'subway surfers', 'can-can remix', 'kiss me again', -- Additional song presets, gathered from published F3X / HD Admin music GUIs. 'C00lkidd Theme', 'Backroom', 'Sonic.EXE', "Can't Stop Raving", 'You Are An Idiot Remix', 'Euro Techno', 'Squid Game', 'Painters Sparta', 'Jumpscare Sound', 'Undertale Music', 'Noob', 'SadRC7 Music', -- New, non-duplicate IDs from three additional published F3X / HD Admin GUIs. 'China Meme', 'LNickys Theme', 'Realm Join', 'Java 1x3x5x6 Theme', 'Colkax Theme', 'Get Job!!!', 'GET OUT!', 'SANEES', 'HERE I COME', 'Sad Song', 'C00lkidd Funk', 'Low Throat Singing 3', 'No Escape', 'Spain Music', 'Bodypartz', 'Gangsta\'s Paradise', 'Theme v3 (Blue2spooky)', 'Better Off Alone', 'Electro Sp00k', 'Wonga', 'Lavender Town', 'Trololo', 'Horror', 'You\'ve Been Trolled', 'Coikax Theme (LNicky)', 'TikTok Music', 'Beethoven Virus', 'Money Talks', 'Jumpstyle (Alternate)', 'Jumpstyle 2', 'Arabic Music', 'Theme v4 (LNicky)', } local FACES = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Left, Enum.NormalId.Right, Enum.NormalId.Top, Enum.NormalId.Bottom, } local SKY_FACES = {'SkyboxBk','SkyboxDn','SkyboxFt','SkyboxLf','SkyboxRt','SkyboxUp'} local songIds = { [1] = '1836769525', -- Deja Vu (Theme), user-confirmed [2] = '81231974674893', [3] = '1836759260', -- TrafficConeHax Realm Music (Easy Mover), user-provided [4] = '104879348278763', -- Khmer Jump 2: exact title KHMER JUMPSTYLE 2 [5] = '1839246711', -- Jumpsyle: alternative Jumpstyle by Kosinus [6] = '1847661821', [7] = '85481339656782', -- Spooky Scary Skeletons (c00lkidd spooky test 2), user-confirmed [8] = '71832077699939', -- Windows Sparta Remix, user-provided [9] = '74786603084060', [10] = '1839272156', [11] = '1839270925', -- Bomb Hard OL, user-provided [13] = '127311606500697', -- Mosaku, user-confirmed [14] = '16831104459', [15] = '112081821066140', -- Dubstep Gun (dubstep gun 2), user-confirmed [16] = '108035501622201', -- Daisy Bell, user-confirmed [17] = '123721043128338', -- The Perfect Girl, confirmed from newest now-playing screenshot [21] = '1840194801', -- Can-Can, user-confirmed [22] = '82210016119269', -- Subway Surfers (subway), user-confirmed [23] = '89769275855705', -- Can-Can Remix (NightGreen), user-confirmed [20] = '117019693520293', -- AWP, user-provided [24] = '111820058348556', -- Kiss Me Again: alternate song-title match [12] = '139488665764275', [18] = '134029357675350', -- Creepy Music (Nico Nextbots Yoshie), user-confirmed [19] = '79388988992739', -- Mario Paint Theme, user-confirmed -- From retrokiddv2's published Music GUI Correction v2 (ScriptBlox): [25] = '95156028272944', -- C00lkidd Theme [26] = '120817494107898', -- Backroom [27] = '133180219581309', -- Sonic.EXE [28] = '89787069440374', -- Can't Stop Raving [29] = '102295928741521', -- You Are An Idiot Remix [30] = '1839246734', -- Euro Techno [31] = '1843536434', -- Squid Game [32] = '76286178156432', -- Painters Sparta [33] = '6129291390', -- Jumpscare Sound -- From CrazyRC7's published F3X Music GUI (ScriptBlox): [34] = '84989010700738', -- Undertale Music [35] = '81094005824673', -- Noob [36] = '86330104497720', -- SadRC7 Music -- Additional song IDs, copied from source-listed presets (not playback-verified). [37] = '121922837560201', -- China Meme | retrokiddv2 [38] = '86412047196482', -- LNickys Theme | retrokiddv2 [39] = '9069609200', -- Realm Join | retrokiddv2 [40] = '94284750410104', -- Java 1x3x5x6 Theme | retrokiddv2 [41] = '71485248296105', -- Colkax Theme | retrokiddv2 [42] = '112747391792663', -- Get Job!!! | retrokiddv2 [43] = '17573042535', -- GET OUT! | retrokiddv2 [44] = '100093014571503', -- SANEES | retrokiddv2 [45] = '78534559289195', -- HERE I COME | retrokiddv2 [46] = '125591252722564', -- Sad Song | retrokiddv2 [47] = '100828050594137', -- C00lkidd Funk | retrokiddv2 [48] = '1845939536', -- Low Throat Singing 3 | retrokiddv2 [49] = '18841891575', -- No Escape | retrokiddv2 [50] = '77535208560062', -- Spain Music | retrokiddv2 [51] = '127653283576622', -- Bodypartz | retrokiddv2 [52] = '5228173823', -- Gangsta's Paradise | retrokiddv2 [53] = '1842652230', -- Theme v3 (Blue2spooky) | blue2spooky [54] = '138194554038974', -- Better Off Alone | blue2spooky [55] = '99986264226275', -- Electro Sp00k | blue2spooky [56] = '100792696468630', -- Wonga | blue2spooky [57] = '85789014973504', -- Lavender Town | blue2spooky [58] = '8389041427', -- Trololo | blue2spooky [59] = '13061809', -- Horror | blue2spooky [60] = '112626671704099', -- You've Been Trolled | blue2spooky [61] = '1839272148', -- Coikax Theme (LNicky) | lnicky [62] = '93218265275853', -- TikTok Music | lnicky [63] = '123235415862774', -- Beethoven Virus | lnicky [64] = '87808442990313', -- Money Talks | lnicky [65] = '99412574770868', -- Jumpstyle (Alternate) | lnicky [66] = '83080737598138', -- Jumpstyle 2 | lnicky [67] = '122919988808125', -- Arabic Music | lnicky [68] = '87617522673082', -- Theme v4 (LNicky) | lnicky } -- Verified against an available TrafficConeHax GUI source for identical audio IDs: -- 1x1x1x1 / 139488665764275 = 0.74. -- Other pitch presets below are existing Pixel GUI settings, not verified against v8. -- Songs without a preset play at normal pitch 1.0; use SAVE PITCH to customize. -- The new entries' pitches are copied from the publishers' song-button settings, -- NOT verified against Roblox audio playback (which depends on asset permissions). local songPitches = { [1] = 0.9, [12] = 0.74, [17] = 0.8, [25] = 0.22, [26] = 0.8, [27] = 0.1, [28] = 1, [29] = 0.14, [30] = 1, [31] = 1, [32] = 0.2, [33] = 1, [34] = 1, [35] = 0.099, [36] = 0.099, -- Pitches copied from the source music buttons; 1.0 when no pitch command was provided. [37] = 0.22, [38] = 1, [39] = 1, [40] = 0.2, [41] = 1, [42] = 1, [43] = 1, [44] = 1, [45] = 1, [46] = 0.1, [47] = 1, [48] = 1, [49] = 1, [50] = 1, [51] = 1, [52] = 1, [53] = 0.45, [54] = 0.21, [55] = 0.2, [56] = 0.143, [57] = 0.16, [58] = 1, [59] = 0.2, [60] = 0.2, [61] = 0.9, [62] = 1, [63] = 1.12, [64] = 0.2, [65] = 1, [66] = 1, [67] = 1.12, [68] = 0.74, } -- Session-only timing settings, configured in the SETTINGS tab. -- Minimums deliberately prevent the GUI from flooding remote requests. local defaults = { commandPrefix = ';', -- HD Admin's default prefix; may be ':' in some games commandDelay = 0.5, -- seconds between HD Admin commands in a sequence commandCooldown = 1.25, -- cooldown after starting an HD Admin command batch f3xDelay = 0.20, -- seconds between F3X requests in supported operations decalCooldown = 2, -- seconds between one-part decal operations batchCooldown = 5, -- seconds between build fills realmPartDelay = 0.18, -- moderate build pace; fewer requests + grouped styling realmCooldown = 8, -- seconds between realm creations skyCooldown = 5, -- seconds between sky dome attempts } local config = {} for key, value in pairs(defaults) do config[key] = value end -- Optional persistence, only when the runtime supplies its local file APIs. local PREFIX_FILE='RetroF3X_HDAdmin_Prefix.txt' if type(readfile)=='function' then local ok, stored=pcall(function() return readfile(PREFIX_FILE) end) if ok and type(stored)=='string' then local candidate=stored:gsub('%s+','') if #candidate==1 and candidate:match('^[;:!.]$') then config.commandPrefix=candidate end end end local selectedSong = 1 local selectedPart = nil local pickMode = false local busy = false local lastEdit = 0 local faceIndex = 1 local savedSkies = nil local localSky = nil local f3xSkyPart = nil -- Keep track of parts made by this GUI across repeated script executions within -- the SAME Roblox server. Without this, running the GUI again leaves old builds -- behind because all the local Lua variables are reset. local env = _G if type(getgenv)=='function' then local ok, value=pcall(getgenv) if ok and type(value)=='table' then env=value end end local mapSessionKey=tostring(game.PlaceId)..':'..tostring(game.JobId) -- Reattach the GUI-created sky dome when Pixel GUI is re-executed in the -- same server. This preserves Pixel Sky 1 / 2 and avoids duplicate domes. do local saved=env.__PixelGUI_SkyDomeSession if type(saved)=='table' and saved.sessionKey==mapSessionKey then local part=saved.part if typeof(part)=='Instance' and part:IsA('BasePart') and part:IsDescendantOf(workspace) then f3xSkyPart=part end end end local realmRegistry=env.__RetroF3X_OwnRealmParts if type(realmRegistry)~='table' or realmRegistry.sessionKey~=mapSessionKey then realmRegistry={sessionKey=mapSessionKey, parts={}, origin=nil} env.__RetroF3X_OwnRealmParts=realmRegistry end if type(realmRegistry.parts)~='table' then realmRegistry.parts={} end local realmParts = realmRegistry.parts -- Independent per-server registry: wings are never mixed with map/scenery parts. local wingRegistry=env.__PixelGUI_TitanWings if type(wingRegistry)~='table' or wingRegistry.sessionKey~=mapSessionKey then wingRegistry={sessionKey=mapSessionKey,records={},busy=false,serial=0,cancel=false} env.__PixelGUI_TitanWings=wingRegistry end if type(wingRegistry.records)~='table' then wingRegistry.records={} end -- An old GUI instance's animation stops when its screen GUI is destroyed. wingRegistry.busy=false wingRegistry.cancel=false wingRegistry.serial=(tonumber(wingRegistry.serial) or 0)+1 -- Titan shell has separate ownership from both map scenery and Titan Wings. local titanRegistry=env.__PixelGUI_TitanMode if type(titanRegistry)~='table' or titanRegistry.sessionKey~=mapSessionKey then titanRegistry={sessionKey=mapSessionKey, records={},serial=0,busy=false, enabled=false,laserBusy=false,cancel=false} env.__PixelGUI_TitanMode=titanRegistry end if type(titanRegistry.records)~='table' then titanRegistry.records={} end titanRegistry.serial=(tonumber(titanRegistry.serial) or 0)+1 titanRegistry.busy=false titanRegistry.laserBusy=false titanRegistry.cancel=false local realmBusy = false local realmAnimation = {active=false,serial=0,objects={},theme=nil} local startRealmAnimation local stopRealmAnimation local armyActions = {} -- F3X army controls, shared with the Event Builder local lastRealmResult = {ok=false, detail='Not run yet'} local lastRealmBuild = -999 local lastSkyEdit = -999 local lastBatchEdit = -999 local rememberedLightingSkyState = nil local outlineSelection = Instance.new('SelectionBox') outlineSelection.Name = 'RetroF3X_PartSelection' outlineSelection.LineThickness = .06 outlineSelection.Color3 = GOLD outlineSelection.SurfaceTransparency = .86 outlineSelection.Adornee = nil outlineSelection.Parent = guiParent local function ui(className, properties, parent) local object = Instance.new(className) for key, value in pairs(properties or {}) do object[key] = value end object.Parent = parent return object end local function stroke(object, color, width) return ui('UIStroke', { Color=color or GOLD,Thickness=width or 1,Transparency=0.55, },object) end local function textButton(parent, label, x, y, width, height, onClick) local button = ui('TextButton', { Position=UDim2.fromOffset(x,y), Size=UDim2.fromOffset(width,height), Text=label, BackgroundColor3=DARK, BorderSizePixel=0, TextColor3=WHITE, TextSize=14, TextWrapped=true, Font=Enum.Font.GothamMedium, AutoButtonColor=true, },parent) ui('UICorner',{CornerRadius=UDim.new(0,5)},button) stroke(button) if onClick then button.MouseButton1Click:Connect(onClick) end return button end local function textbox(parent, placeholder, x, y, width, height) local box = ui('TextBox', { Position=UDim2.fromOffset(x,y), Size=UDim2.fromOffset(width,height), BackgroundColor3=PANEL, BorderSizePixel=0, PlaceholderText=placeholder, PlaceholderColor3=QUIET, ClearTextOnFocus=false, Text='', TextColor3=WHITE, Font=Enum.Font.Gotham, TextSize=14, },parent) ui('UICorner',{CornerRadius=UDim.new(0,5)},box) stroke(box) ui('UIPadding',{PaddingLeft=UDim.new(0,8),PaddingRight=UDim.new(0,8)},box) return box end local function label(parent, s, x, y, width, height, fontSize, color) return ui('TextLabel', { Position=UDim2.fromOffset(x,y),Size=UDim2.fromOffset(width,height), BackgroundTransparency=1,Text=s, TextColor3=color or WHITE, TextSize=fontSize or 14,Font=Enum.Font.Gotham, TextXAlignment=Enum.TextXAlignment.Left, TextWrapped=true, }, parent) end local function normalizeAssetId(raw) local str = tostring(raw or ''):gsub('%s+','') if str == '' then return nil end local digits = str:match('^rbxassetid://(%d+)$') or str:match('[?&]id=(%d+)') or str:match('^(%d+)$') if not digits or #digits > 17 or tonumber(digits) == 0 then return nil end return digits end local gui = ui('ScreenGui',{ Name='PixelGUI',ResetOnSpawn=false,IgnoreGuiInset=false, DisplayOrder=30,ZIndexBehavior=Enum.ZIndexBehavior.Sibling, },guiParent) local toggle = textButton(gui,'Pixel GUI',12,0,92,28) toggle.Position=UDim2.new(0,14,1,-46) local WINDOW_W, WINDOW_H = 832, 572 local root = ui('Frame',{ Name='Main',Size=UDim2.fromOffset(WINDOW_W,WINDOW_H), Position=UDim2.new(.5,-WINDOW_W/2,.5,-WINDOW_H/2), BackgroundColor3=DARK,BorderSizePixel=0,Active=true, },gui) ui('UICorner',{CornerRadius=UDim.new(0,8)},root) stroke(root,GOLD,1) -- Fit within smaller displays while preserving a large, legible layout. local fit = ui('UIScale', {Scale=1}, root) local function updateFit() local camera = workspace.CurrentCamera if not camera then return end local viewport = camera.ViewportSize fit.Scale = math.min(1, math.max(.55, math.min((viewport.X - 32)/WINDOW_W, (viewport.Y - 75)/WINDOW_H))) * (root:GetAttribute('CompactView') and .82 or 1) end updateFit() if workspace.CurrentCamera then workspace.CurrentCamera:GetPropertyChangedSignal('ViewportSize'):Connect(updateFit) end local bar = ui('Frame',{ Size=UDim2.new(1,0,0,39),BackgroundColor3=SOFT,BorderSizePixel=0, },root) label(bar,'Pixel GUI / 1.20.6',15,6,685,28,18,GOLD).Name='PixelTitle' local minimize=textButton(bar,'−',747,4,34,30) local close=textButton(bar,'×',787,4,34,30) -- Feature Hub stays available without occupying a navigation tab. local activateFeatureSearch=function() end local findButton=textButton(bar,'FIND',635,4,100,30,function() activateFeatureSearch() end) local tabRow = ui('Frame',{ Size=UDim2.new(1,-18,0,36),Position=UDim2.fromOffset(9,44), BackgroundTransparency=1, },root) local content = ui('Frame',{ Size=UDim2.new(1,-18,0,435),Position=UDim2.fromOffset(9,87), BackgroundColor3=PANEL,BorderSizePixel=0, },root) ui('UICorner',{CornerRadius=UDim.new(0,6)},content) stroke(content,GOLD,1) local status = label(root,'Ready • '..#realmParts..' tracked map parts • Settings → Appearance',13,531,802,34,13,AMBER) local function say(s, good) if not status.Parent then return end status.Text = tostring(s) status.TextColor3 = good and GREEN or AMBER end stopRealmAnimation=function(silent) realmAnimation.active=false realmAnimation.serial=realmAnimation.serial+1 if not silent and gui.Parent then say('Realm animation stopped.',true) end end local pages={} local tabButtons={} config.activeColor=Color3.fromRGB(104,65,91) local function activateTab(tab) gui:SetAttribute('PixelActiveTab',tab) for name, page in pairs(pages) do page.Visible=(name==tab) end for name, button in pairs(tabButtons) do button.BackgroundColor3=(name==tab) and config.activeColor or DARK button.TextColor3=(name==tab) and GOLD or WHITE end end local tabCount = 0 local function addTab(name, caption) local index = tabCount tabCount = tabCount + 1 tabButtons[name] = textButton(tabRow,caption,index*90,0,87,34,function() activateTab(name) end) tabButtons[name].TextSize = 12 -- The Scripts tab is scrollable so extra modules don't cover old shortcuts. if name=='hub' or name=='scripts' or name=='settings' or name=='decals' or name=='maps' or name=='events' then pages[name]=ui('ScrollingFrame',{ Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Visible=false, BorderSizePixel=0,ScrollBarThickness=8,ScrollBarImageColor3=GOLD, CanvasSize=UDim2.fromOffset(0,name=='settings' and 650 or (name=='decals' and 965 or (name=='maps' and 1880 or (name=='events' and 1750 or 2560)))),ScrollingDirection=Enum.ScrollingDirection.Y, },content) else pages[name]=ui('Frame',{ Size=UDim2.fromScale(1,1),BackgroundTransparency=1,Visible=false, },content) end return pages[name] end local musicPage=addTab('music','MUSIC') local decalsPage=addTab('decals','DECALS') local skyPage=addTab('sky','SKY') local realmPage=addTab('realm','REALMS') local mapPage=addTab('maps','MAPS') local scriptsPage=addTab('scripts','SCRIPTS') local settingsPage=addTab('settings','SETTINGS') local eventPage=addTab('events','EVENTS') local antiSkidPage=addTab('antiskid','ANTI-SKID') -- Feature Hub is available via the FIND title-bar button and Ctrl+K; -- it isn't a tenth navigation tab. config.featureHubPage=addTab('hub','FIND') tabButtons.hub.Visible=false -- Appearance presets. All recoloring is cosmetic: map parts, audio data, -- texture previews, and build permissions are intentionally left unchanged. config.appearanceStore=env.__PixelGUI_Appearance if type(config.appearanceStore)~='table' then config.appearanceStore={theme='rose',layout='classic'} env.__PixelGUI_Appearance=config.appearanceStore end do local APPEARANCE_FILE='PixelGUI_Appearance.json' local palettes={ rose={name='Rose Graphite',accent=Color3.fromRGB(226,143,185), dark=Color3.fromRGB(34,35,40),panel=Color3.fromRGB(44,45,51), soft=Color3.fromRGB(61,63,70),text=Color3.fromRGB(242,240,244), quiet=Color3.fromRGB(177,177,189),success=Color3.fromRGB(141,219,170), warning=Color3.fromRGB(235,191,145),active=Color3.fromRGB(92,55,77), border=Color3.fromRGB(122,100,118)}, midnight={name='Midnight Blue',accent=Color3.fromRGB(118,160,250), dark=Color3.fromRGB(19,25,38),panel=Color3.fromRGB(27,37,55), soft=Color3.fromRGB(41,54,73),text=Color3.fromRGB(235,241,254), quiet=Color3.fromRGB(161,176,199),success=Color3.fromRGB(125,213,187), warning=Color3.fromRGB(243,190,137),active=Color3.fromRGB(39,76,132), border=Color3.fromRGB(68,91,120)}, gold={name='Obsidian Gold',accent=Color3.fromRGB(232,186,93), dark=Color3.fromRGB(21,21,22),panel=Color3.fromRGB(33,32,34), soft=Color3.fromRGB(53,50,49),text=Color3.fromRGB(245,241,230), quiet=Color3.fromRGB(188,178,162),success=Color3.fromRGB(157,221,170), warning=Color3.fromRGB(239,183,131),active=Color3.fromRGB(100,74,37), border=Color3.fromRGB(111,91,64)}, cyan={name='Circuit Cyan',accent=Color3.fromRGB(89,214,217), dark=Color3.fromRGB(16,27,31),panel=Color3.fromRGB(24,42,46), soft=Color3.fromRGB(40,63,66),text=Color3.fromRGB(230,246,246), quiet=Color3.fromRGB(156,186,187),success=Color3.fromRGB(145,223,170), warning=Color3.fromRGB(237,191,145),active=Color3.fromRGB(30,94,102), border=Color3.fromRGB(66,114,117)}, lilac={name='Soft Violet',accent=Color3.fromRGB(182,153,247), dark=Color3.fromRGB(30,26,40),panel=Color3.fromRGB(43,38,55), soft=Color3.fromRGB(63,56,77),text=Color3.fromRGB(244,238,253), quiet=Color3.fromRGB(193,180,210),success=Color3.fromRGB(156,226,177), warning=Color3.fromRGB(238,192,150),active=Color3.fromRGB(88,65,119), border=Color3.fromRGB(115,98,139)}, paper={name='Paper Light',accent=Color3.fromRGB(131,76,125), dark=Color3.fromRGB(226,226,232),panel=Color3.fromRGB(247,247,250), soft=Color3.fromRGB(212,213,224),text=Color3.fromRGB(34,38,48), quiet=Color3.fromRGB(99,102,120),success=Color3.fromRGB(24,124,73), warning=Color3.fromRGB(145,91,43),active=Color3.fromRGB(222,198,218), border=Color3.fromRGB(174,163,183)}, forest={name='Forest Moss',accent=Color3.fromRGB(145,198,132), dark=Color3.fromRGB(22,30,26),panel=Color3.fromRGB(32,43,36), soft=Color3.fromRGB(49,64,52),text=Color3.fromRGB(233,245,232), quiet=Color3.fromRGB(168,191,167),success=Color3.fromRGB(165,224,155), warning=Color3.fromRGB(239,190,145),active=Color3.fromRGB(50,85,56), border=Color3.fromRGB(78,106,84)}, ember={name='Ember Black',accent=Color3.fromRGB(244,125,88), dark=Color3.fromRGB(29,24,25),panel=Color3.fromRGB(44,34,34), soft=Color3.fromRGB(65,46,45),text=Color3.fromRGB(249,238,229), quiet=Color3.fromRGB(199,174,165),success=Color3.fromRGB(143,214,163), warning=Color3.fromRGB(248,189,126),active=Color3.fromRGB(112,59,47), border=Color3.fromRGB(122,75,63)}, mono={name='Monochrome',accent=Color3.fromRGB(201,205,211), dark=Color3.fromRGB(20,22,25),panel=Color3.fromRGB(37,39,44), soft=Color3.fromRGB(54,57,63),text=Color3.fromRGB(241,242,243), quiet=Color3.fromRGB(169,173,180),success=Color3.fromRGB(166,218,174), warning=Color3.fromRGB(227,193,153),active=Color3.fromRGB(83,87,94), border=Color3.fromRGB(100,103,110)}, sunset={name='Sunset Coral',accent=Color3.fromRGB(248,155,133), dark=Color3.fromRGB(44,30,46),panel=Color3.fromRGB(58,41,58), soft=Color3.fromRGB(78,55,76),text=Color3.fromRGB(255,241,240), quiet=Color3.fromRGB(215,188,198),success=Color3.fromRGB(172,224,183), warning=Color3.fromRGB(250,202,139),active=Color3.fromRGB(117,70,88), border=Color3.fromRGB(139,93,112)}, frost={name='Arctic Glass',accent=Color3.fromRGB(115,212,245), dark=Color3.fromRGB(21,35,49),panel=Color3.fromRGB(31,49,63), soft=Color3.fromRGB(50,72,88),text=Color3.fromRGB(235,249,255), quiet=Color3.fromRGB(173,206,220),success=Color3.fromRGB(161,234,199), warning=Color3.fromRGB(250,211,158),active=Color3.fromRGB(39,103,129), border=Color3.fromRGB(77,131,155)}, terminal={name='Terminal Green',accent=Color3.fromRGB(85,224,145), dark=Color3.fromRGB(13,21,19),panel=Color3.fromRGB(21,32,27), soft=Color3.fromRGB(36,51,40),text=Color3.fromRGB(220,244,218), quiet=Color3.fromRGB(147,186,156),success=Color3.fromRGB(112,239,165), warning=Color3.fromRGB(231,198,131),active=Color3.fromRGB(25,77,48), border=Color3.fromRGB(59,100,73)}, } local order={'music','decals','sky','realm','maps','scripts','settings','events','antiskid'} local palette={accent=GOLD,dark=DARK,panel=PANEL,soft=SOFT, text=WHITE,quiet=QUIET,success=GREEN,warning=AMBER,active=config.activeColor, border=GOLD} local look=game:GetService('HttpService') if type(readfile)=='function' then local ok,raw=pcall(function() return readfile(APPEARANCE_FILE) end) if ok and type(raw)=='string' then local good,data=pcall(function() return look:JSONDecode(raw) end) if good and type(data)=='table' then if palettes[data.theme] then config.appearanceStore.theme=data.theme end if data.layout=='classic' or data.layout=='left' or data.layout=='right' or data.layout=='compact' or data.layout=='tworow' or data.layout=='bottom' or data.layout=='wide' then config.appearanceStore.layout=data.layout end end end end local function saveAppearance() if type(writefile)=='function' then pcall(function() writefile(APPEARANCE_FILE,look:JSONEncode({ theme=config.appearanceStore.theme,layout=config.appearanceStore.layout})) end) end end local function swapColor(current,old,new) if current==old.accent then return new.accent end if current==old.dark then return new.dark end if current==old.panel then return new.panel end if current==old.soft then return new.soft end if current==old.text then return new.text end if current==old.quiet then return new.quiet end if current==old.success then return new.success end if current==old.warning then return new.warning end if current==old.active then return new.active end if current==old.border then return new.border end return current end config.applyAppearanceTheme=function(key) local nextPalette=palettes[key] if not nextPalette then return end local oldPalette=palette -- Recolor controls in place, including those that bypass shared builders. for _,element in ipairs(gui:GetDescendants()) do if element:IsA('GuiObject') then if element.BackgroundTransparency<1 then element.BackgroundColor3=swapColor(element.BackgroundColor3,oldPalette,nextPalette) end if element:IsA('TextLabel') or element:IsA('TextBox') or element:IsA('TextButton') then element.TextColor3=swapColor(element.TextColor3,oldPalette,nextPalette) end if element:IsA('ScrollingFrame') then element.ScrollBarImageColor3=nextPalette.accent end elseif element:IsA('UIStroke') then local original=element.Color if original==oldPalette.accent or original==oldPalette.border then element.Color=nextPalette.border else element.Color=swapColor(original,oldPalette,nextPalette) end end end palette=nextPalette GOLD,DARK,PANEL,SOFT=nextPalette.accent,nextPalette.dark,nextPalette.panel,nextPalette.soft WHITE,QUIET,GREEN,AMBER=nextPalette.text,nextPalette.quiet,nextPalette.success,nextPalette.warning config.activeColor=nextPalette.active outlineSelection.Color3=GOLD -- Static elements, including the selected tab, are redrawn after recoloring. root.BackgroundColor3=DARK bar.BackgroundColor3=SOFT content.BackgroundColor3=PANEL bar:FindFirstChild('PixelTitle').TextColor3=GOLD activateTab(gui:GetAttribute('PixelActiveTab') or 'music') config.appearanceStore.theme=key saveAppearance() end config.applyAppearanceLayout=function(name) local valid={classic=true,left=true,right=true,compact=true, tworow=true,bottom=true,wide=true} if not valid[name] then return end local sidebar=(name=='left' or name=='right') local wide=(name=='wide') local bottom=(name=='bottom') local twoRows=(name=='tworow') WINDOW_W=wide and 1100 or ((sidebar or bottom) and 1000 or 832) WINDOW_H=wide and 632 or ((bottom or twoRows) and 622 or 572) root:SetAttribute('CompactView',name=='compact') root.Size=UDim2.fromOffset(WINDOW_W,WINDOW_H) root.Position=UDim2.new(.5,-WINDOW_W/2,.5,-WINDOW_H/2) minimize.Position=UDim2.fromOffset(WINDOW_W-85,4) close.Position=UDim2.fromOffset(WINDOW_W-45,4) findButton.Position=UDim2.fromOffset(WINDOW_W-197,4) bar.Size=UDim2.new(1,0,0,39) bar:FindFirstChild('PixelTitle').Size=UDim2.fromOffset(WINDOW_W-140,28) if sidebar then local left=(name=='left') tabRow.Position=UDim2.fromOffset(left and 12 or 846,64) tabRow.Size=UDim2.fromOffset(143,468) content.Position=UDim2.fromOffset(left and 164 or 9,63) content.Size=UDim2.fromOffset(824,451) for index,key in ipairs(order) do local button=tabButtons[key] button.Position=UDim2.fromOffset(0,(index-1)*43) button.Size=UDim2.fromOffset(140,36) button.TextSize=13 end elseif wide then tabRow.Position=UDim2.fromOffset(10,47) tabRow.Size=UDim2.fromOffset(1080,36) content.Position=UDim2.fromOffset(10,90) content.Size=UDim2.fromOffset(824,485) for index,key in ipairs(order) do local button=tabButtons[key] button.Position=UDim2.fromOffset((index-1)*118,0) button.Size=UDim2.fromOffset(112,34) button.TextSize=13 end elseif bottom then tabRow.Position=UDim2.fromOffset(11,541) tabRow.Size=UDim2.fromOffset(978,36) content.Position=UDim2.fromOffset(9,53) content.Size=UDim2.fromOffset(980,478) for index,key in ipairs(order) do local button=tabButtons[key] button.Position=UDim2.fromOffset((index-1)*108,0) button.Size=UDim2.fromOffset(102,34) button.TextSize=12 end elseif twoRows then tabRow.Position=UDim2.fromOffset(9,46) tabRow.Size=UDim2.fromOffset(814,77) content.Position=UDim2.fromOffset(9,130) content.Size=UDim2.fromOffset(814,435) for index,key in ipairs(order) do local button=tabButtons[key] button.Position=UDim2.fromOffset(((index-1)%5)*163,math.floor((index-1)/5)*40) button.Size=UDim2.fromOffset(158,36) button.TextSize=13 end else tabRow.Position=UDim2.fromOffset(9,44) tabRow.Size=UDim2.new(1,-18,0,36) content.Position=UDim2.fromOffset(9,87) content.Size=UDim2.new(1,-18,0,435) for index,key in ipairs(order) do local button=tabButtons[key] button.Position=UDim2.fromOffset((index-1)*90,0) button.Size=UDim2.fromOffset(86,34) button.TextSize=11 end end if wide then status.Position=UDim2.fromOffset(13,590) elseif bottom or twoRows then status.Position=UDim2.fromOffset(13,585) else status.Position=UDim2.fromOffset(13,530) end status.Size=UDim2.fromOffset(WINDOW_W-30,34) if config.updateQuickRail then config.updateQuickRail(wide) end updateFit() config.appearanceStore.layout=name saveAppearance() end end -- Shared HD Admin gateway is available to other tabs; the song editor's -- temporary locals are scoped to its tab to stay within Luau's local limit. local runCataclysmEvent local hint, requestCooldown, commandBusy local withHDAdminPrefix, submitHDAdminCommand, selectedPitch do -- MUSIC TAB: HD Admin commands, with optional per-song pitch. -- -- Scrollable music grid: extra presets must not overlap Pitch / Play buttons. local grid = ui('ScrollingFrame',{ Size=UDim2.new(1,-18,0,307), Position=UDim2.fromOffset(9,9), BackgroundTransparency=1, BorderSizePixel=0, ScrollBarThickness=7, ScrollBarImageColor3=GOLD, ScrollingDirection=Enum.ScrollingDirection.Y, CanvasSize=UDim2.fromOffset(0,0), ClipsDescendants=true, },musicPage) local musicLayout=ui('UIGridLayout',{ CellSize=UDim2.new(.25,-8,0,46), CellPadding=UDim2.fromOffset(6,5), SortOrder=Enum.SortOrder.LayoutOrder, },grid) local function fitMusicScroll() grid.CanvasSize=UDim2.fromOffset(0,musicLayout.AbsoluteContentSize.Y+8) end musicLayout:GetPropertyChangedSignal('AbsoluteContentSize'):Connect(fitMusicScroll) local songButtons = {} local presetCount = 0 for _, id in pairs(songIds) do if id then presetCount=presetCount+1 end end local function displayName(s) -- Preserve exact casing for names supplied with custom capitalization. if s=='AWP' or s=='Bomb Hard OL' or s=='TrafficConeHax Realm Music' or s=='C00lkidd Theme' or s=='Sonic.EXE' or s=='SadRC7 Music' or s=="Can't Stop Raving" then return s end return (s:gsub('(%a)([%a]*)',function(a,b) return a:upper()..b end)) end local nowPlaying = label(musicPage,'Selected: Theme',15,322,505,27,19,GOLD) hint = label(musicPage,'Choose an ID-backed song: '..config.commandPrefix..'music → '..config.commandPrefix..'volume inf → '..config.commandPrefix..'pitch.',15,350,777,23,14,WHITE) -- Prefer the HD Admin command signal when available; otherwise use ordinary -- player chat. Neither path bypasses server-side rank/permission checks. requestCooldown = 0 commandBusy = false -- Every HD Admin action (music, Scripts, Events, Barrier Kick, Loopkick, -- etc.) uses this single command gateway. Change only the leading prefix; -- never alter IDs, usernames, messages or other command arguments. withHDAdminPrefix = function(command) local raw=tostring(command or '') if raw:sub(1,1)==';' or raw:sub(1,1)==':' then return config.commandPrefix..raw:sub(2) end return raw end submitHDAdminCommand = function(command) command=withHDAdminPrefix(command) local hd = ReplicatedStorage:FindFirstChild('HDAdminHDClient') local signals = hd and hd:FindFirstChild('Signals') local request = signals and signals:FindFirstChild('RequestCommandSilent') if request and request:IsA('RemoteFunction') then local ok, result = pcall(function() return request:InvokeServer(command) end) if not ok then return false, tostring(result) end if result == false then return false, 'The server returned false (command may be denied).' end return true, 'HD Admin remote' end local inputBar = TextChatService:FindFirstChild('ChatInputBarConfiguration') local channel = inputBar and inputBar.TargetTextChannel if not channel then local channels = TextChatService:FindFirstChild('TextChannels') channel = channels and channels:FindFirstChild('RBXGeneral') end if channel and channel:IsA('TextChannel') then local ok, err = pcall(function() channel:SendAsync(command) end) if ok then return true, 'Roblox chat' end return false, tostring(err) end return false, 'No HD Admin command signal or usable Roblox text channel found.' end selectedPitch = function(index) local n = tonumber(songPitches[index]) if n and n >= 0.05 and n <= 4 then return n end return 1 end local pitchBox -- initialized after the song buttons local function tryPlay(songIndex) local id = songIds[songIndex] if not id then hint.Text='NO ID FOUND for this recording. Add an ID under CUSTOM ID.' say('No researched ID for '..SONGS[songIndex]..'. Use CUSTOM ID to supply one.') return end if commandBusy or os.clock() - requestCooldown < config.commandCooldown then return say('Wait a moment before requesting another song (anti-spam cooldown).') end requestCooldown=os.clock() commandBusy=true local pitch = selectedPitch(songIndex) hint.Text='Sending '..config.commandPrefix..'music '..id..' → '..config.commandPrefix..'volume inf → '..config.commandPrefix..'pitch '..tostring(pitch) say('Submitting HD Admin music, volume and pitch (requires admin permission)...',true) task.spawn(function() -- Send commands separately to support HD Admin and chat fallback. local steps = { ';music '..id, ';volume inf', ';pitch '..tostring(pitch), } local errors={} for i,cmd in ipairs(steps) do if not gui.Parent then break end local ok, detail=submitHDAdminCommand(cmd) if not ok then table.insert(errors, cmd..': '..tostring(detail):sub(1,55)) end if i<#steps then task.wait(config.commandDelay) end -- user-set pace; server limit still applies end if gui.Parent then if #errors==0 then hint.Text='Requested '..displayName(SONGS[songIndex])..' | volume inf | pitch '..tostring(pitch) say('Sent '..config.commandPrefix..'music, '..config.commandPrefix..'volume inf and '..config.commandPrefix..'pitch. Server may limit volume or audio access.',true) else hint.Text='HD Admin: '..table.concat(errors,'; '):sub(1,114) say('One or more HD Admin commands failed; check rank, rate limits, and console.') end end commandBusy=false end) end local function updateSongButtons() for index,button in ipairs(songButtons) do local ready = songIds[index] ~= nil if selectedSong==index then button.BackgroundColor3=config.activeColor button.TextColor3=WHITE else button.BackgroundColor3=ready and DARK or SOFT button.TextColor3=ready and WHITE or Color3.fromRGB(216,216,216) end button.Text=displayName(SONGS[index])..(ready and ' ✓' or ' · No ID') end nowPlaying.Text='Selected: '..displayName(SONGS[selectedSong]) if pitchBox then pitchBox.Text=tostring(songPitches[selectedSong] or 1) end end for index, songName in ipairs(SONGS) do local button=ui('TextButton',{ LayoutOrder=index,Text='',TextSize=15, TextWrapped=true,TextColor3=WHITE,Font=Enum.Font.GothamMedium, BorderSizePixel=0,BackgroundColor3=DARK, AutoButtonColor=true, },grid) stroke(button, songIds[index] and GOLD or Color3.fromRGB(100,100,100), 1) table.insert(songButtons,button) button.MouseButton1Click:Connect(function() selectedSong=index updateSongButtons() tryPlay(index) end) end fitMusicScroll() local playAgain=textButton(musicPage,'▶ PLAY SELECTED',15,382,185,36,function() tryPlay(selectedSong) end) textButton(musicPage,'■ STOP',210,382,119,36,function() if commandBusy or os.clock()-requestCooldown < config.commandCooldown then return say('Wait a moment before stopping music (anti-spam cooldown).') end requestCooldown=os.clock() commandBusy=true task.spawn(function() local ok,detail=submitHDAdminCommand(';unmusic') if gui.Parent then hint.Text=ok and ('Requested '..config.commandPrefix..'unmusic (HD Admin)') or ('Stop failed: '..tostring(detail):sub(1,100)) say(ok and 'HD Admin stop command submitted.' or ('Stop failed: '..tostring(detail)),ok) end commandBusy=false end) end) local customField = textbox(musicPage,'Optional Roblox audio ID',477,383,205,34) customField.Visible=false local saveCustom saveCustom=textButton(musicPage,'SAVE + PLAY',691,382,117,36,function() local id=normalizeAssetId(customField.Text) if not id then return say('Enter a valid Roblox audio ID in the custom box.') end songIds[selectedSong]=id customField.Text='' updateSongButtons() local button=songButtons[selectedSong] if button then for _,outline in ipairs(button:GetChildren()) do if outline:IsA('UIStroke') then outline.Color=GOLD end end end tryPlay(selectedSong) end) saveCustom.Visible=false -- Diagnostic: issue only ;music so users can isolate command/permission/audio -- failures from pitch or ;volume inf. This is not a local audio player. local testMusicButton=textButton(musicPage,'TEST '..config.commandPrefix..'music ONLY',477,382,205,36,function() local id=songIds[selectedSong] if not id then return say('No preset ID for this song. Supply a custom ID first.') end if commandBusy or os.clock()-requestCooldown < config.commandCooldown then return say('Wait for the command cooldown before testing another song.') end requestCooldown=os.clock() commandBusy=true hint.Text='Testing ONLY '..config.commandPrefix..'music '..id..' (no volume or pitch)' say('Testing the HD Admin music command alone...',true) task.spawn(function() local ok,detail=submitHDAdminCommand(';music '..id) if gui.Parent then if ok then hint.Text='Sent '..config.commandPrefix..'music '..id..' via '..tostring(detail)..'. Check whether it is audible.' say('Music command sent (not proof it played). Check HD Admin rank and asset access.',true) else hint.Text='Music request failed: '..tostring(detail):sub(1,120) say('Music test failed. Check HD Admin, permissions and console.') end end commandBusy=false end) end) local customOpen=false local customButton customButton=textButton(musicPage,'CUSTOM ID +',340,382,128,36,function() customOpen=not customOpen customField.Visible=customOpen saveCustom.Visible=customOpen testMusicButton.Visible=not customOpen customButton.Text=customOpen and 'CUSTOM ID −' or 'CUSTOM ID +' if customOpen then customField.Text=songIds[selectedSong] or '' end end) -- Optional per-song pitch control; blank = no preset (uses normal 1x speed). label(musicPage,'Pitch',550,319,53,31,15,GOLD) pitchBox=textbox(musicPage,'1',600,321,77,30) pitchBox.Text=tostring(songPitches[selectedSong] or 1) textButton(musicPage,'SAVE PITCH',690,320,118,32,function() local entered=pitchBox.Text:gsub('%s+','') if entered=='' then songPitches[selectedSong]=nil pitchBox.Text='1' return say('Pitch reset to normal (1x) for '..displayName(SONGS[selectedSong])..'.',true) end local amount=tonumber(entered) if not amount or amount<0.05 or amount>4 then return say('Pitch must be between 0.05 and 4 (1 = normal speed).') end songPitches[selectedSong]=amount pitchBox.Text=tostring(amount) say('Saved pitch '..tostring(amount)..' for '..displayName(SONGS[selectedSong])..'.',true) end) local footer=label(musicPage, tostring(presetCount)..' / '..tostring(#SONGS)..' songs have IDs • Scroll for more • PLAY uses HD Admin • Some uploads may be unavailable', 14,421,790,14,12,QUIET) updateSongButtons() end -- MUSIC controls scope local findEquippedF3X, isPlayerCharacterPart, applyServerF3XDecals, updateSelected, pickButton do -- DECAL STUDIO: explicit target, image preview, presets and bounded F3X texture edits. -- label(decalsPage,'DECAL STUDIO / PIXEL GUI',14,10,760,27,19,GOLD) label(decalsPage,'IMAGE OR DECAL ASSET ID',14,45,370,22,14,WHITE) local decalIdBox=textbox(decalsPage,'Paste Roblox image or decal ID',14,72,490,38) local selectedDecalNote=label(decalsPage,'No image selected',14,115,493,23,12,QUIET) local preview=ui('ImageLabel',{ Position=UDim2.fromOffset(551,55),Size=UDim2.fromOffset(225,196), BackgroundColor3=DARK,BorderSizePixel=0,Image='', ScaleType=Enum.ScaleType.Fit, },decalsPage) stroke(preview,GOLD,1) local previewTitle=label(decalsPage,'IMAGE PREVIEW',552,254,223,24,14,GOLD) local function previewDecal(id) id=normalizeAssetId(id or decalIdBox.Text) if not id then selectedDecalNote.Text='Enter a valid Roblox image ID (numbers only).' return false end preview.Image='rbxassetid://'..id selectedDecalNote.Text='Selected image ID: '..id return true end -- Look for the actual tool endpoint, regardless of whether it is held or in Backpack. -- Both locations are supported by the standard F3X SyncAPI. findEquippedF3X=function() local char=player.Character local bag=player:FindFirstChildOfClass('Backpack') for _,container in ipairs({char,bag}) do if container then for _,tool in ipairs(container:GetChildren()) do if tool:IsA('Tool') then local sync=tool:FindFirstChild('SyncAPI') local endpoint=sync and sync:FindFirstChild('ServerEndpoint') if endpoint and endpoint:IsA('RemoteFunction') then return tool,endpoint end end end end end return nil,nil end textButton(decalsPage,'PREVIEW IMAGE',14,149,239,36,function() if previewDecal() then say('Showing selected decal in the preview.',true) end end) textButton(decalsPage,'CONVERT DECAL ID',266,149,238,36,function() if busy then return say('Finish the current F3X operation first.') end local id=normalizeAssetId(decalIdBox.Text) if not id then return say('Enter a Roblox decal asset ID.') end local _,endpoint=findEquippedF3X() if not endpoint then return say('Equip F3X/BTools before converting a decal asset.') end busy=true task.spawn(function() local ok,result=pcall(function() return endpoint:InvokeServer('ExtractImageFromDecal',tonumber(id)) end) busy=false if not gui.Parent then return end local converted=ok and normalizeAssetId(result) if not converted then return say('Could not convert this decal ID. Try its underlying image ID.') end decalIdBox.Text=converted previewDecal(converted) say('Image ID resolved: '..converted,true) end) end) label(decalsPage,'YOUR PRESETS',14,200,484,24,15,GOLD) local DECAL_PRESETS={ {name='PIXEL DECAL 1',id='93544399411478'}, {name='PIXEL DECAL 2',id='87626606643966'}, {name='REALM SIGN',id='109474272580873'}, } for i,preset in ipairs(DECAL_PRESETS) do local item=preset local x=14+(i-1)*165 local button=textButton(decalsPage,item.name,x,229,158,36,function() decalIdBox.Text=item.id previewDecal(item.id) say(item.name..' selected. Click LOAD DECAL to apply to your target.',true) end) button.TextSize=12 end -- Shared selected-part handler is also called by the existing world picker. local partLabel=label(decalsPage,'Selected part: none',14,308,768,24,13,QUIET) local onDecalSelectionChanged updateSelected=function(part) selectedPart=part outlineSelection.Adornee=part partLabel.Text=part and ('Selected part: '..part.Name) or 'Selected part: none' if onDecalSelectionChanged then onDecalSelectionChanged() end if part then say('Selected '..part.Name..'. Choose a model target or edit the part.',true) end end pickButton=textButton(decalsPage,'PICK PART IN WORLD',14,338,243,37,function() pickMode=not pickMode pickButton.Text=pickMode and 'CLICK A PART NOW...' or 'PICK PART IN WORLD' say(pickMode and 'Click a visible part outside the GUI.' or 'Picker canceled.',true) end) textButton(decalsPage,'CLEAR SELECTION',269,338,235,37,function() updateSelected(nil) end) isPlayerCharacterPart=function(part) local model=part:FindFirstAncestorOfClass('Model') return model and model:FindFirstChildOfClass('Humanoid') ~= nil end local function decalOnFace(part,face) for _, child in ipairs(part:GetChildren()) do if child:IsA('Decal') and child.Face==face then return child end end return nil end -- CreateTextures({{Part=part,Face=face,TextureType="Decal"}}) -- SyncTexture({{Part=part,Face=face,TextureType="Decal",Texture=...}}) -- Use this on the chosen build only. It is NOT a client-only Instance.new("Decal"). -- Keep one request per face: official F3X groups requests by Part, so one 6-face -- batch for the same part can collapse to a single face. applyServerF3XDecals=function(parts,faces,imageId,endpoint) local content='rbxassetid://'..imageId local attempted=0 for _,part in ipairs(parts) do if part and part:IsA('BasePart') and part:IsDescendantOf(workspace) and not isPlayerCharacterPart(part) then for _,face in ipairs(faces) do -- Avoid extra -- copies when this face already has one, so presets can be rerun. if not decalOnFace(part,face) then endpoint:InvokeServer('CreateTextures',{{ Part=part,Face=face,TextureType='Decal' }}) task.wait(config.f3xDelay) end endpoint:InvokeServer('SyncTexture',{{ Part=part,Face=face,TextureType='Decal',Texture=content }}) attempted=attempted+1 task.wait(config.f3xDelay) end end end -- The server may reject an edit without throwing an error. Confirm what -- actually replicated rather than reporting success based on the remote call. task.wait(0.45) local confirmed=0 for _,part in ipairs(parts) do if part and part.Parent then for _,face in ipairs(faces) do local decal=decalOnFace(part,face) if decal and tostring(decal.Texture):match('(%d+)$')==imageId then confirmed=confirmed+1 end end end end return attempted,confirmed end local function executeServerF3XDecals(parts,faces,imageId,endpoint,labelText) busy=true say('Requesting '..labelText..' with F3X server Texture Tool...',true) task.spawn(function() local ok,attempted,confirmed=pcall(function() return applyServerF3XDecals(parts,faces,imageId,endpoint) end) busy=false if not gui.Parent then return end if not ok then say('F3X failed: '..tostring(attempted):sub(1,135)) elseif confirmed==attempted and attempted>0 then say('F3X changed '..confirmed..' decal face(s). Confirm another player sees them.',true) elseif confirmed>0 then say('F3X applied '..confirmed..'/'..attempted..' decal faces. Others may be denied or still replicating.') else say('No F3X decals confirmed. Check tool permissions, image ID, and server limits.') end end) end -- Quick single-part tools remain available below the main LOAD DECAL workflow. local faceIndexButton local function onePartFill(allFaces) if busy then return say('Finish the current F3X request first.') end if os.clock()-lastEdit5000 then return nil,'Max parts must be a whole number from 1 to 5000.' end return n,nil end local function canEditDecalPart(part) return part and part:IsA('BasePart') and part:IsDescendantOf(workspace) and not isPlayerCharacterPart(part) and not part:FindFirstAncestorOfClass('Tool') and not part:IsA('SpawnLocation') end local function scanTargetParts(root,limit) local gathered={} local total=0 if decalScope=='realm' then for i,part in ipairs(realmRegistry.parts) do if scanState.cancel then return nil,'Scan canceled.' end if canEditDecalPart(part) then total=total+1 if total<=limit then gathered[#gathered+1]=part end end if i%300==0 then task.wait() end end else for i,part in ipairs(root:GetDescendants()) do if scanState.cancel then return nil,'Scan canceled.' end if canEditDecalPart(part) then total=total+1 if total<=limit then gathered[#gathered+1]=part end end if i%300==0 then task.wait() end end end if total==0 then return nil,'No eligible parts found in selected target.' end if total>limit then return nil,('Target has %d eligible parts; limit is %d. Increase limit and rescan (no partial fill).'):format(total,limit) end return gathered,nil end local function describeDecalTarget(root) return decalScope=='realm' and 'your Pixel GUI realm' or root.Name end local function scanDecalTarget(armAfterScan) if busy or scanState.running or scanState.scanning then return say('Finish the current F3X job first.') end local id=normalizeAssetId(decalIdBox.Text) if not id then return say('Choose a valid decal ID first.') end local root,scopeError=decalTargetsRoot() if not root then return say(scopeError) end local limit,limitError=decalPartLimit() if not limit then return say(limitError) end resetDecalScan() scanState.scanning=true scanState.cancel=false targetProgress.Text='Scanning '..describeDecalTarget(root)..'...' task.spawn(function() local ok,parts,err=pcall(function() return scanTargetParts(root,limit) end) scanState.scanning=false if not gui.Parent then return end if not ok or not parts then resetDecalScan() targetProgress.Text='SCAN FAILED: '..tostring(ok and err or parts):sub(1,175) return say(targetProgress.Text) end scanState.parts=parts scanState.root=root scanState.id=id scanState.limit=limit scanState.count=#parts scanState.confirmed=armAfterScan==true scanState.armedAt=armAfterScan and (os.clock()+30) or 0 local descriptor=describeDecalTarget(root) targetProgress.Text=('%d parts / %d faces in %s. %s'):format( #parts,#parts*6,descriptor, armAfterScan and 'Click LOAD DECAL again within 30s to confirm.' or 'Click LOAD DECAL to confirm.') say(targetProgress.Text,true) end) end local function sameDecalTarget() local root=decalTargetsRoot() return root and scanState.root==root end local function applyMapDecalJob(parts,endpoint,id,scopeRoot) local texture='rbxassetid://'..id local requestCount,failures=0,0 local changed=0 local batchSize=8 local finished=false for startIndex=1,#parts,batchSize do if scanState.cancel or not gui.Parent then break end if not sameDecalTarget() or (scopeRoot~=realmRegistry and not scopeRoot:IsDescendantOf(workspace)) then failures=failures+1 break end local finishIndex=math.min(#parts,startIndex+batchSize-1) for _,face in ipairs(FACES) do if scanState.cancel or not gui.Parent then break end local creates,updates={},{} for i=startIndex,finishIndex do local part=parts[i] local belongs=(scopeRoot==realmRegistry) or part:IsDescendantOf(scopeRoot) if belongs and canEditDecalPart(part) then local decal=decalOnFace(part,face) if not decal then creates[#creates+1]={Part=part,Face=face,TextureType='Decal'} end if not decal or tostring(decal.Texture)~=texture then updates[#updates+1]={Part=part,Face=face,TextureType='Decal',Texture=texture} end end end if #creates>0 then local ok,response=pcall(function() return endpoint:InvokeServer('CreateTextures',creates) end) requestCount=requestCount+1 if not ok or response==false then failures=failures+1 end task.wait(math.max(0.12,config.f3xDelay)) end if #updates>0 then local ok,response=pcall(function() return endpoint:InvokeServer('SyncTexture',updates) end) requestCount=requestCount+1 if not ok or response==false then failures=failures+1 end changed=changed+#updates task.wait(math.max(0.12,config.f3xDelay)) end if failures>=6 then break end end local percent=math.floor(finishIndex/#parts*100) targetProgress.Text=('LOADING DECAL... %d/%d parts (%d%%) | %d F3X requests | %d errors'):format( finishIndex,#parts,percent,requestCount,failures) if failures>=6 then break end task.wait() if finishIndex==#parts then finished=true end end task.wait(0.35) local verified=0 for i,part in ipairs(parts) do if part and part.Parent then for _,face in ipairs(FACES) do local d=decalOnFace(part,face) if d and tostring(d.Texture):match('(%d+)$')==id then verified=verified+1 end end end if i%300==0 then task.wait() end end local interrupted=scanState.cancel scanState.running=false busy=false resetDecalScan() if not gui.Parent then return end local result=(interrupted and 'Canceled' or not finished and 'Stopped early' or 'Completed').. (': %d/%d faces verified | %d requests | %d errors'):format(verified,#parts*6,requestCount,failures) targetProgress.Text=result say(result,verified>0) end local loadDecalButton loadDecalButton=textButton(decalsPage,'LOAD DECAL',257,527,305,50,function() if busy or scanState.running or scanState.scanning then return say('A scan or F3X edit is already in progress.') end if os.clock()-lastBatchEditscanState.armedAt then scanState.confirmed=true scanState.armedAt=os.clock()+30 return say('Ready: '..#scanState.parts..' parts × 6 faces. Click LOAD DECAL again to confirm.') end local _,endpoint=findEquippedF3X() if not endpoint then return say('Equip BTools/F3X with SyncAPI before loading.') end if #scanState.parts==0 then return say('Scan your target first.') end lastBatchEdit=os.clock() scanState.running=true scanState.cancel=false busy=true local parts,root,selectedId=scanState.parts,scanState.root,id targetProgress.Text='Starting F3X decal application to '..#parts..' parts...' task.spawn(function() local ok,err=pcall(function() applyMapDecalJob(parts,endpoint,selectedId,root) end) if not ok then scanState.running=false busy=false resetDecalScan() if gui.Parent then targetProgress.Text='F3X operation failed: '..tostring(err):sub(1,140) say(targetProgress.Text) end end end) end) textButton(decalsPage,'SCAN TARGET',14,527,231,50,function() scanDecalTarget(false) end) textButton(decalsPage,'CANCEL',574,527,202,50,function() if scanState.running or scanState.scanning then scanState.cancel=true return say('Stopping after current F3X request. Applied faces remain changed.',true) end resetDecalScan() targetProgress.Text='Previous scan cleared.' say('Decal selection scan cleared.',true) end) label(decalsPage,'F3X texture edits apply to all 6 faces of the chosen target. Never to unknown Workspace parts.', 14,583,763,27,12,QUIET) -- Smaller, precise operations for the selected part. label(decalsPage,'SINGLE-PART TOOLS',14,706,760,27,15,GOLD) faceIndexButton=textButton(decalsPage,'FACE: FRONT',14,746,234,36,function() faceIndex=faceIndex%#FACES+1 faceIndexButton.Text='FACE: '..string.upper(FACES[faceIndex].Name) end) textButton(decalsPage,'APPLY ONE FACE',258,746,246,36,function() onePartFill(false) end) textButton(decalsPage,'APPLY ALL 6 FACES',517,746,259,36,function() onePartFill(true) end) textButton(decalsPage,'CHECK F3X / BTOOLS',14,794,366,36,function() local tool,endpoint=findEquippedF3X() say(endpoint and ('Detected '..tool.Name..'. The server must still authorize edits.') or 'No F3X SyncAPI tool detected in Character or Backpack.',endpoint~=nil) end) label(decalsPage, 'LOAD DECAL changes existing faces and creates missing decals with authorized F3X Texture Tool calls. ' ..'Scope is your own tracked Pixel GUI realm or a selected map model in a place you own. ' ..'Large targets take time, and server permissions can reject any request. ' ..'Back up original models before applying; no automatic undo is available.', 14,843,758,95,13,AMBER) end -- DECAL STUDIO local scope; five functions exposed to existing modules. -- SKYBOX TAB (LOCAL PREVIEW + F3X-MESH DOME) -- label(skyPage,'Sky image ID (local preview / F3X sky mesh)',14,16,620,28,16,GOLD) local skyIdBox=textbox(skyPage,'Enter Roblox image ID',14,51,551,33) -- Mesh SCALE, not an exact measurement of studs across; Roblox mesh bounds vary. local DEFAULT_SKY_SCALE = 4000 label(skyPage,'DOME MESH SCALE',583,16,210,28,16,GOLD) local skyScaleBox=textbox(skyPage,'4000',583,51,207,33) skyScaleBox.Text = tostring(DEFAULT_SKY_SCALE) local function selectedSkyScale() local n=tonumber(skyScaleBox.Text) if not n or n~=n or n==math.huge or n==-math.huge then return nil,'Enter a number for sky mesh scale (500–8000).' end if n<500 or n>8000 then return nil,'Sky mesh scale must be between 500 and 8000.' end return math.floor(n) end label(skyPage,'LOCAL preview uses Lighting; SHARED dome uses authorized F3X CreatePart/SyncMesh.',14,100,760,39,13,AMBER) local function applyLocalSky() local id=normalizeAssetId(skyIdBox.Text) if not id then return say('Enter a valid numeric sky image asset ID.') end if not savedSkies then savedSkies={} for _,item in ipairs(Lighting:GetChildren()) do if item:IsA('Sky') then table.insert(savedSkies,item:Clone()) end end end for _,item in ipairs(Lighting:GetChildren()) do if item:IsA('Sky') then item:Destroy() end end localSky=Instance.new('Sky') localSky.Name='RetroF3X_LocalSky' for _,prop in ipairs(SKY_FACES) do localSky[prop]='rbxassetid://'..id end localSky.Parent=Lighting say('Local skybox preview applied. Other players cannot see it.',true) end local function restoreSky() if not savedSkies then return say('No previous skybox snapshot to restore.') end for _,item in ipairs(Lighting:GetChildren()) do if item:IsA('Sky') then item:Destroy() end end for _,item in ipairs(savedSkies) do item.Parent=Lighting end savedSkies=nil localSky=nil say('Previous local skybox restored.',true) end textButton(skyPage,'LOCAL SKY PREVIEW',14,158,267,40,applyLocalSky) textButton(skyPage,'RESTORE LOCAL SKY',299,158,266,40,restoreSky) -- The following builds one removable, anchored, noncolliding mesh through the -- official F3X SyncAPI. No require(), no client-side server permission bypass. local function createF3XSkyDome() if busy or realmBusy then return say('An F3X operation is already running.') end if os.clock()-lastSkyEdit0 then return nil,nil,'Found '..table.concat(classic,', ')..'. These tools have no F3X CreatePart interface; only F3X-style BTools can generate new realm pieces.' end return nil,nil,'No F3X/BTools CreatePart tool found in your Character or Backpack.' end local function realmSpecs(theme, detailed) if theme=='PIXEL' then -- Inspired by the user's black outfit, gold/white angel wings, crown, -- sparkling aura, and the pink platform seen in the screenshot. local charcoal=Color3.fromRGB(26,26,35) local wall=Color3.fromRGB(43,40,53) local obsidian=Color3.fromRGB(16,17,23) local rose=Color3.fromRGB(241,126,188) local roseSoft=Color3.fromRGB(195,110,164) local gold=Color3.fromRGB(202,159,76) local pearl=Color3.fromRGB(239,236,229) local ivory=Color3.fromRGB(206,209,230) local accent=Color3.fromRGB(140,109,180) local pieces={} local function add(x,y,z,sx,sy,sz,color,material,collide,animation,rx,ry,rz) table.insert(pieces,{ offset=Vector3.new(x,y,z),size=Vector3.new(sx,sy,sz),color=color, material=material or Enum.Material.SmoothPlastic,collide=(collide~=false), animation=animation, rotation=CFrame.Angles(math.rad(rx or 0),math.rad(ry or 0),math.rad(rz or 0)), }) end -- Outer dimensions: 96 x 96; side walls height 38, roof is 38 studs up. add( 0, 0, 0, 96,2,96,charcoal,Enum.Material.Slate) add( 0,38, 0, 96,2,96,obsidian,Enum.Material.Slate) add(-47,19, 0, 2,38,96,wall) add( 47,19, 0, 2,38,96,wall) add( 0,19,-47, 96,38,2,wall) -- Two front walls and lintel leave a 22-stud opening facing the player. add(-29.5,19,47,37,38,2,wall) add( 29.5,19,47,37,38,2,wall) add(0,34,47,22,8,2,wall) -- Glow trims around the entrance and at the floor / roof lines. add(-12,17,47.9,2,32,1,rose,Enum.Material.Neon,true,'pulse') add( 12,17,47.9,2,32,1,rose,Enum.Material.Neon,true,'pulse') add( 0,32,47.9,26,2,1,gold,Enum.Material.Neon,true,'pulse') add( 0, 2, 0,12,0.4,80,roseSoft,Enum.Material.Neon,false) -- Avatar throne at the back; black pedestal and elegant gold details. add( 0, 2,-28,26,2,22,obsidian) add( 0, 7,-35,12,13,3,gold) add( 0, 9,-33, 8,11,1,charcoal) add(-6, 5,-31, 3, 6,7,gold) add( 6, 5,-31, 3, 6,7,gold) add( 0,15,-33, 8,1.5,2,pearl,Enum.Material.Neon,false,'pulse') add(-4,17,-33,2,5,2,gold) add( 0,18,-33,2,7,2,gold) add( 4,17,-33,2,5,2,gold) -- White-and-gold wing silhouette behind throne. Decorative only. for _,side in ipairs({-1,1}) do add(side*13,15,-37, 3,17,2,pearl,Enum.Material.SmoothPlastic,false,nil,0,0,side*30) add(side*21,16,-37, 3,15,2,ivory,Enum.Material.SmoothPlastic,false,nil,0,0,side*50) add(side*29,15,-37, 2.5,12,2,gold,Enum.Material.Metal,false,nil,0,0,side*65) end -- Corner pylons and four hovering crystal beacons. for _,x in ipairs({-37,37}) do for _,z in ipairs({-35,35}) do add(x,9,z,4,18,4,obsidian,Enum.Material.Metal) add(x,19,z,6,2,6,gold,Enum.Material.Neon,false,'pulse') add(x,24,z,4,5,4,pearl,Enum.Material.Neon,false,'float') end end -- Ceiling star strips; pulsing instead of thousands of part spam. add(-24,36.2,0,2,1,68,rose,Enum.Material.Neon,false,'pulse') add( 24,36.2,0,2,1,68,rose,Enum.Material.Neon,false,'pulse') add(0,36.2,0,64,1,2,gold,Enum.Material.Neon,false,'pulse') if detailed then -- Detailed mode adds more ornamentation; identical enclosed hall. for _,x in ipairs({-30,-15,15,30}) do add(x,1.6,10,2,.5,55,pearl,Enum.Material.Neon,false) end add(0,2.5,21,12,2,12,gold,Enum.Material.Metal) add(0,5,21,5,3,5,pearl,Enum.Material.Neon,false,'float') end return pieces end local tint=theme=='VOID' and Color3.fromRGB(100,35,205) or Color3.fromRGB(202,159,76) local highlight=theme=='VOID' and Color3.fromRGB(180,91,255) or Color3.fromRGB(235,218,183) return { {offset=Vector3.new(0,0,0),size=Vector3.new(32,1,32),color=Color3.fromRGB(23,23,34),material=Enum.Material.Slate,collide=true}, {offset=Vector3.new(-12,4,-12),size=Vector3.new(2,8,2),color=tint,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(12,4,-12),size=Vector3.new(2,8,2),color=tint,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(-12,4,12),size=Vector3.new(2,8,2),color=tint,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(12,4,12),size=Vector3.new(2,8,2),color=tint,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(0,9,-11),size=Vector3.new(18,2,2),color=highlight,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(0,13,-11),size=Vector3.new(2,8,2),color=highlight,material=Enum.Material.Neon,collide=true}, {offset=Vector3.new(0,1,0),size=Vector3.new(9,.4,9),color=highlight,material=Enum.Material.Neon,collide=true}, } end -- Map blueprints use the SAME CreatePart + grouped SyncResize/SyncColor/ -- SyncMaterial pipeline as PIXEL REALM, never a separate server remote. -- This builds scoped scenery and never touches existing unrelated map parts. local function expandedMapSpecs(theme, quality) local specs={} quality=math.clamp(math.floor(tonumber(quality) or 2),1,3) local C={ dark=Color3.fromRGB(19,20,30),stone=Color3.fromRGB(42,43,58), grey=Color3.fromRGB(91,97,120),rose=Color3.fromRGB(238,139,191), gold=Color3.fromRGB(235,179,67),white=Color3.fromRGB(235,231,245), blue=Color3.fromRGB(91,173,252),cyan=Color3.fromRGB(52,223,238), violet=Color3.fromRGB(147,81,243),ice=Color3.fromRGB(155,218,245), ember=Color3.fromRGB(245,97,41),red=Color3.fromRGB(194,48,72), green=Color3.fromRGB(91,178,110),wood=Color3.fromRGB(103,63,67), } local M=Enum.Material local function add(x,y,z,w,h,d,color,material,collide,rot) if #specs >= 185 then return end specs[#specs+1]={offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=color or C.white,material=material or M.SmoothPlastic, collide=collide~=false,rotation=rot and CFrame.Angles(0,math.rad(rot),0) or nil} end local function platform(size,color) add(0,0,0,size,2,size,color or C.dark,M.Slate) end local function boxHall(color,accent) platform(110,C.dark) add(-54,20,0,2,40,108,color,M.Slate) add(54,20,0,2,40,108,color,M.Slate) add(0,20,-54,108,40,2,color,M.Slate) add(-34,20,54,40,40,2,color,M.Slate) add(34,20,54,40,40,2,color,M.Slate) add(0,37,54,27,6,2,color,M.Slate) add(0,41,0,110,2,110,color,M.Slate) add(0,3,0,10,.5,105,accent,M.Neon,false) add(-13,20,53,2,34,1,accent,M.Neon,false) add(13,20,53,2,34,1,accent,M.Neon,false) add(0,38,53,29,2,1,accent,M.Neon,false) end if theme=='VOID' or theme=='GOLD' then local accent=(theme=='GOLD' and C.gold or C.violet) local wall=(theme=='GOLD' and C.wood or C.stone) local secondary=(theme=='GOLD' and C.white or C.cyan) boxHall(wall,accent) add(0,3,-37,24,4,21,C.dark,M.Metal) add(0,10,-43,14,15,3,accent,M.Metal) add(0,12,-39,9,12,3,secondary,M.SmoothPlastic) for _,side in ipairs({-1,1}) do for i=-2,2 do local z=i*19 add(side*43,16,z,4,32,4,secondary,M.Marble) add(side*43,33,z,7,3,7,accent,M.Metal) if quality>=2 then add(side*48,25,z,1,11,8,accent,M.Neon,false) end end add(side*19,20,-44,3,24,2,secondary,M.Metal,false) add(side*27,22,-44,4,18,2,accent,M.Metal,false) end if quality>=2 then for i=-3,3 do add(i*13,2,0,2,.3,92,accent,M.Neon,false) add(i*13,39,0,1,1,95,secondary,M.Metal,false) end end if quality>=3 then for i=-3,3 do add(0,2,i*13,93,.3,1,secondary,M.Neon,false) add(0,39,i*13,95,1,1,accent,M.Metal,false) end end elseif theme=='NeonMegacity' then platform(150,C.dark) for _,side in ipairs({-1,1}) do add(0,1.2,side*19,150,.3,3,C.cyan,M.Neon,false) add(side*19,1.2,0,3,.3,150,C.rose,M.Neon,false) end for ix=-2,2 do for iz=-2,2 do if ix~=0 and iz~=0 then local x,z=ix*25,iz*25 local ht=22+((ix*7+iz*11+100)%4)*8 local col=((ix+iz)%2==0) and C.violet or C.blue add(x,ht/2+2,z,15,ht,15,C.stone,M.Metal) add(x,ht+3,z,16,2,16,col,M.Neon) if quality>=2 then for floor=1,math.floor(ht/8) do add(x,3+floor*8,z+8,12,2,.3,col,M.Neon,false) add(x+8,3+floor*8,z,.3,2,12,C.cyan,M.Neon,false) end end if quality>=3 then add(x,ht+6,z,2,5,2,C.gold,M.Neon) end end end end for i=-2,2 do add(i*27,5,12,1,10,1,C.grey,M.Metal) add(i*27,11,12,4,2,4,C.rose,M.Neon,false) if quality>=2 then add(i*27,5,-12,1,10,1,C.grey,M.Metal) end end if quality>=2 then add(0,14,0,130,2,6,C.blue,M.Glass,false) add(0,15,0,130,.5,1,C.cyan,M.Neon,false) end elseif theme=='CrystalCavern' then boxHall(C.stone,C.violet) add(0,2,-10,35,.5,30,C.blue,M.Glass,false) for i=1,22 do if quality>=2 or i<=11 then local x=((i*37)%94)-47 local z=((i*29)%94)-47 local h=6+(i%5)*4 add(x,1+h/2,z,3,h,3,(i%3==0) and C.cyan or C.violet,M.Neon,false,(i*13)%180) if quality>=3 then add(x+4,1+h/3,z+2,2,h*.65,2,C.ice,M.Glass,false,(i*23)%180) end end end for i=1,13 do if quality>=2 or i<=7 then local x=((i*31)%92)-46 local z=((i*17)%92)-46 local h=5+(i%4)*3 add(x,40-h/2,z,3,h,3,C.grey,M.Slate) end end elseif theme=='SakuraSanctuary' then platform(145,C.green) add(0,1.2,0,16,.4,138,C.wood,M.WoodPlanks) add(0,1.2,-35,62,.4,28,C.blue,M.Glass,false) add(0,5,-48,32,8,15,C.wood,M.Wood) add(0,12,-48,40,3,23,C.rose,M.SmoothPlastic) add(0,16,-48,25,2,15,C.gold,M.Metal) for i=1,10 do if quality>=2 or i<=6 then local side=(i%2==0) and 1 or -1 local z=-60+i*12 local x=side*(24+(i%3)*7) add(x,8,z,3,15,3,C.wood,M.Wood) for j=1,quality do add(x+(j-2)*4,17+(j%2)*3,z,14,7,13,C.rose,M.SmoothPlastic,false) end add(side*11,5,z,2,9,2,C.gold,M.Metal) add(side*11,10,z,4,4,4,C.rose,M.Neon,false) end end for z=-35,35,17 do add(-9,10,z,2,18,2,C.red,M.Wood) add(9,10,z,2,18,2,C.red,M.Wood) add(0,18,z,24,2,3,C.red,M.Wood) add(0,21,z,28,2,3,C.wood,M.Wood) end elseif theme=='FrozenCitadel' then platform(155,C.ice) add(0,18,-50,102,35,8,C.grey,M.Ice) for _,side in ipairs({-1,1}) do add(side*50,18,0,8,35,110,C.grey,M.Ice) add(side*29,18,50,42,35,8,C.grey,M.Ice) for _,z in ipairs({-50,50}) do add(side*50,24,z,15,48,15,C.blue,M.Ice) add(side*50,50,z,18,5,18,C.ice,M.Neon) end end add(0,37,50,25,5,8,C.ice,M.Ice) add(0,2,-30,25,4,20,C.blue,M.Glass) add(0,10,-36,13,13,4,C.ice,M.Neon) for i=1,(quality==1 and 8 or quality==2 and 16 or 24) do local x=((i*31)%122)-61 local z=((i*23)%95)-47 local h=5+(i%5)*2 add(x,2+h/2,z,2,h,2,C.white,M.Ice,false) end elseif theme=='InfernoForge' then platform(145,C.dark) for _,side in ipairs({-1,1}) do add(side*48,13,0,9,26,114,C.wood,M.Slate) add(side*21,1.2,0,12,.4,132,C.ember,M.Neon,false) end add(0,1.5,0,16,1,140,C.grey,M.Metal) add(0,12,-43,36,23,19,C.wood,M.Brick) add(0,14,-30,20,15,2,C.red,M.Neon,false) add(0,24,-43,39,5,20,C.grey,M.Metal) for i=-3,3 do add(i*17,5,22,4,9,4,C.grey,M.Metal) add(i*17,12,22,8,5,8,C.ember,M.Neon,false) if quality>=2 then add(i*17,17,22,3,9,3,C.wood,M.Metal) add(i*17,23,22,5,3,5,C.gold,M.Neon) end end if quality>=3 then for i=-4,4 do add(i*13,19,-10,3,3,3,C.gold,M.Neon) add(i*13,30,-10,1,18,1,C.grey,M.Metal,false) end end elseif theme=='CelestialObservatory' then platform(145,C.dark) add(0,2,0,84,1,84,C.blue,M.Metal) add(0,3,0,68,.5,68,C.violet,M.Glass,false) for i=1,16 do if quality>=2 or i%2==0 then local a=i*math.pi/8 local x,z=math.cos(a)*54,math.sin(a)*54 add(x,13,z,4,24,4,C.white,M.Marble) add(x,26,z,7,3,7,C.gold,M.Neon,false) if quality>=3 then add(x*.8,29,z*.8,2,6,2,C.cyan,M.Neon,false) end end end add(0,11,0,20,18,20,C.white,M.Marble) add(0,22,0,27,4,27,C.gold,M.Metal) for i=1,(quality==1 and 8 or quality==2 and 16 or 26) do local a=i*2*math.pi/26 local r=27+(i%3)*5 add(math.cos(a)*r,30+(i%5)*2,math.sin(a)*r,5,2,3,(i%2==0) and C.cyan or C.rose,M.Neon,false,i*14) end elseif theme=='EventHorizon' then platform(150,C.dark) add(0,2,0,45,2,45,C.violet,M.Neon,false) add(0,5,0,30,6,30,C.dark,M.Slate) add(0,28,0,34,34,34,C.dark,M.SmoothPlastic,false) for i=1,(quality==1 and 12 or quality==2 and 24 or 36) do local a=i*math.pi*2/(quality==1 and 12 or quality==2 and 24 or 36) local r=40+(i%3)*6 add(math.cos(a)*r,17+(i%5)*2,math.sin(a)*r,8,2,2,(i%2==0) and C.rose or C.violet,M.Neon,false,i*360/36) end for i=1,8 do local a=i*math.pi/4 add(math.cos(a)*58,18,math.sin(a)*58,5,36,5,C.stone,M.Metal) add(math.cos(a)*58,38,math.sin(a)*58,7,4,7,C.cyan,M.Neon,false) end if quality>=3 then for i=1,20 do local a=i*math.pi/10 add(math.cos(a)*30,12+(i%6)*3,math.sin(a)*30,3,3,3,C.grey,M.Slate,false,i*13) end end end return specs end local mapBlueprint do -- Keep the large castle generator scoped to avoid Luau's local-variable limit. -- PIXEL ASCENDANT CITADEL: a large open-air kingdom, not an enclosed hall. -- All geometry is made with the existing player-authorized F3X CreatePart workflow. -- Classic / Detailed / Ultra preserve the same layout with increasing decoration. local function ascendantCitadelSpecs(quality) quality=math.clamp(math.floor(tonumber(quality) or 2),1,3) local parts={} local M=Enum.Material local C={ abyss=Color3.fromRGB(18,17,28), obsidian=Color3.fromRGB(29,27,42), basalt=Color3.fromRGB(51,48,68), stone=Color3.fromRGB(86,82,109), silver=Color3.fromRGB(190,187,208), pearl=Color3.fromRGB(240,232,239), gold=Color3.fromRGB(213,171,86), gilded=Color3.fromRGB(251,215,135), rose=Color3.fromRGB(235,132,187), pink=Color3.fromRGB(245,170,207), violet=Color3.fromRGB(128,91,195), blue=Color3.fromRGB(103,163,232), cyan=Color3.fromRGB(118,232,244), water=Color3.fromRGB(65,102,151), grass=Color3.fromRGB(51,78,80), wood=Color3.fromRGB(92,60,85), } local function add(x,y,z,w,h,d,col,mat,collide,rx,ry,rz) if #parts>=480 then return end parts[#parts+1]={ offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=col or C.silver,material=mat or M.SmoothPlastic, collide=collide~=false, rotation=(rx or ry or rz) and CFrame.Angles( math.rad(rx or 0),math.rad(ry or 0),math.rad(rz or 0)) or nil, } end local function mirror(x,y,z,w,h,d,col,mat,collide) add(-x,y,z,w,h,d,col,mat,collide) add( x,y,z,w,h,d,col,mat,collide) end local function glow(x,y,z,w,h,d,col) add(x,y,z,w,h,d,col or C.rose,M.Neon,false) end -- THE OPEN KINGDOM: 640 x 640 studs, completely roofless and walkable. add(0,0,0,640,2,640,C.abyss,M.Slate) add(0,1.1,122,46,.35,380,C.basalt,M.Cobblestone) glow( 23.5,1.36,124,.8,.35,365,C.gold) glow(-23.5,1.36,124,.8,.35,365,C.gold) add(0,1.22,110,102,.4,102,C.obsidian,M.Marble) add(0,1.45,110,74,.3,74,C.basalt,M.Slate) -- Thin border on the perimeter; courtyard remains open to the sky. mirror(314,5,0,8,10,628,C.basalt,M.Slate) add(0,5,314,615,10,8,C.basalt,M.Slate) add(0,5,-314,615,10,8,C.basalt,M.Slate) mirror(313,12,0,2,3,624,C.gold,M.Metal,false) add(0,12,314,614,3,2,C.gold,M.Metal,false) -- Wide entry avenue and monumental front gateway. mirror(48,12,274,12,24,12,C.stone,M.Marble) mirror(48,26,274,18,5,18,C.gold,M.Metal) add(0,29,274,100,8,12,C.basalt,M.Metal) glow(0,34,274,104,2,13,C.rose) mirror(54,41,274,7,19,7,C.gilded,M.Metal) if quality>=2 then mirror(48,18,280,3,26,2,C.pink,M.Neon,false) add(0,28,282,63,2,2,C.gold,M.Metal,false) end -- CASTLE FOUNDATION AND GRAND OPEN COURT: broad stone terraces. add(0,2,-208,454,5,194,C.obsidian,M.Slate) add(0,4.4,-211,420,.5,178,C.basalt,M.Marble) add(0,2,-119,74,4,34,C.stone,M.Marble) add(0,3,-108,58,3,18,C.silver,M.Marble) add(0,1.2,-98,78,.4,42,C.gold,M.Metal) -- Main facade: 68-stud central gate and double-height open-air battlements. mirror(124,44,-130,182,86,15,C.basalt,M.Slate) add(0,76,-130,69,24,16,C.obsidian,M.Slate) mirror(40,34,-119,9,64,13,C.gold,M.Metal) mirror(49,34,-116,3,52,3,C.rose,M.Neon,false) add(0,90,-130,440,5,18,C.gold,M.Metal) mirror(216,48,-210,13,96,178,C.basalt,M.Slate) mirror(216,91,-210,17,5,182,C.gold,M.Metal) -- Back wall split: center is open for a dramatic throne silhouette. mirror(128,44,-291,185,86,13,C.basalt,M.Slate) mirror(94,50,-286,5,100,8,C.gold,M.Metal) mirror(165,16,-210,50,24,130,C.obsidian,M.Metal) mirror(165,29,-210,50,3,130,C.gold,M.Metal) -- ROYAL THRONE: elevated dais, broad staircase, throne, tall back and crown. add(0,7,-252,98,10,79,C.obsidian,M.Marble) add(0,13,-260,79,4,50,C.gold,M.Metal) for step=1,5 do add(0,2.5+step*1.7,-199-step*6,90-step*7,3.2,7,C.silver,M.Marble) end add(0,17,-269,32,5,22,C.gilded,M.Metal) add(0,32,-282,30,34,9,C.obsidian,M.Metal) add(0,31,-275,23,26,2,C.violet,M.SmoothPlastic) mirror(19,23,-271,8,16,27,C.gold,M.Metal) mirror(19,34,-283,8,10,9,C.gilded,M.Metal) mirror(14,52,-282,8,14,7,C.gold,M.Metal) add(0,56,-282,11,22,8,C.gilded,M.Metal) mirror(7,62,-282,4,13,5,C.pearl,M.Neon,false) add(0,72,-283,15,4,8,C.gold,M.Metal) glow(0,51,-274,20,2,2,C.pink) if quality>=2 then for side=-1,1,2 do add(side*36,20,-272,5,31,5,C.silver,M.Marble) add(side*36,38,-272,9,6,9,C.gold,M.Metal) add(side*36,45,-272,6,10,6,C.pink,M.Neon,false) end -- Stylized wings made of tilted gold / pearl blades behind the seat. for side=-1,1,2 do for i=0,5 do add(side*(32+i*9),38-i*2,-287,4,33-i*3,5, (i%2==0) and C.pearl or C.gilded,M.Metal,false,0,0,side*(23+i*6)) end end end -- SIX HUGE CASTLE TOWERS: front, rear, and outer annex towers. local function turret(x,z,height,wide) add(x,3,z,wide+12,8,wide+12,C.gold,M.Metal) add(x,8+height/2,z,wide,height,wide,C.obsidian,M.Slate) add(x,8+height,z,wide+13,5,wide+13,C.stone,M.Marble) add(x,12+height,z,wide+16,4,wide+16,C.gold,M.Metal) add(x,23+height,z,wide*.65,21,wide*.65,C.basalt,M.Slate) add(x,35+height,z,wide*.75,3,wide*.75,C.gilded,M.Metal) add(x,45+height,z,9,20,9,C.gold,M.Metal) add(x,56+height,z,4,7,4,C.pink,M.Neon,false) if quality>=2 then for side=-1,1,2 do add(x+side*(wide/2+1),28+height/2,z,2,45,10,C.gold,M.Metal,false) add(x,28+height/2,z+side*(wide/2+1),10,45,2,C.gold,M.Metal,false) end for j=-1,1,2 do add(x+j*(wide/3),height+17,z+wide/2,5,10,4,C.silver,M.Marble) end end if quality>=3 then for side=-1,1,2 do add(x+side*(wide/2+2),height*.48,z,1.5,24,13,C.rose,M.Neon,false) add(x,height*.48,z+side*(wide/2+2),13,24,1.5,C.rose,M.Neon,false) end add(x,height+62,z,3,9,3,C.gilded,M.Neon,false) end end for _,x in ipairs({-207,207}) do turret(x,-130,128,39) turret(x,-287,140,42) turret(x*1.34,-216,154,42) end -- Back off the central keep from the throne's rear ornaments so -- the castle remains huge without a solid tower clipping the seat. -- The old main tower started at Z=-286.5, touching the throne backrest. add(0,2,-321,78,5,54,C.obsidian,M.Slate) add(0,58,-321,63,114,39,C.obsidian,M.Slate) add(0,118,-321,76,9,48,C.gold,M.Metal) add(0,153,-321,45,61,36,C.basalt,M.Slate) add(0,188,-321,59,9,45,C.gilded,M.Metal) add(0,208,-321,24,34,23,C.obsidian,M.Metal) add(0,231,-321,7,13,7,C.pink,M.Neon,false) mirror(22,155,-301,3,55,3,C.rose,M.Neon,false) -- Castle gate crown with prominent diamond-shaped ornament. add(0,117,-130,37,35,7,C.gold,M.Metal,false,0,0,45) add(0,117,-123,19,19,3,C.pink,M.Neon,false,0,0,45) if quality>=2 then add(0,140,-130,5,21,5,C.gilded,M.Metal) mirror(60,100,-130,6,17,10,C.pearl,M.Neon,false) mirror(104,98,-130,7,13,10,C.gold,M.Metal) end -- TWO GIANT KNIGHT STATUES frame the open courtyard. local function knight(x,z) add(x,5,z,30,10,30,C.gold,M.Metal) add(x,12,z,24,5,24,C.obsidian,M.Slate) add(x,37,z,18,44,13,C.silver,M.Metal) add(x,65,z,19,17,16,C.gold,M.Metal) add(x,74,z,23,4,18,C.obsidian,M.Metal) add(x,70,z+9,4,4,3,C.pink,M.Neon,false) add(x,57,z,38,5,15,C.silver,M.Metal) add(x,16,z-6,6,11,6,C.gilded,M.Metal) if quality>=2 then add(x+20,44,z,4,64,4,C.gold,M.Metal) add(x+20,80,z,5,13,5,C.pink,M.Neon,false) add(x+20,92,z,5,13,5,C.gilded,M.Metal) add(x-17,52,z,5,22,8,C.obsidian,M.Metal) end end knight(-142,88) knight(142,88) -- REFLECTING POOLS and gardens on both sides of the royal avenue. for _,side in ipairs({-1,1}) do local x=side*195 add(x,1.35,129,110,.5,132,C.water,M.Glass,false) add(x,1.55,129,116,.5,6,C.gold,M.Metal) add(x,1.55,195,116,.5,6,C.gold,M.Metal) add(x-55,1.55,129,6,.5,132,C.gold,M.Metal) add(x+55,1.55,129,6,.5,132,C.gold,M.Metal) add(x,2,129,15,2,15,C.obsidian,M.Marble) add(x,13,129,8,22,8,C.gold,M.Metal) add(x,26,129,13,5,13,C.pink,M.Neon,false) if quality>=2 then for i=-1,1 do add(x+i*35,4,195,8,7,8,C.basalt,M.Slate) add(x+i*35,10,195,5,7,5,C.gilded,M.Neon,false) end end end -- Gate-to-castle lampposts; high tiers get extra lighting. for _,z in ipairs({245,177,109,41,-27,-91}) do for _,side in ipairs({-1,1}) do local x=side*42 add(x,11,z,4,22,4,C.gold,M.Metal) add(x,23,z,9,6,9,C.pink,M.Neon,false) if quality>=2 then add(x,28,z,3,5,3,C.gilded,M.Metal) end end end -- Grand side arcade, terraces and rhythmic supports. mirror(281,1.4,77,34,1,380,C.basalt,M.Marble) mirror(281,3,77,29,2,380,C.gold,M.Metal) if quality>=2 then for _,z in ipairs({-76,-16,44,104,164,224}) do for _,x in ipairs({-282,282}) do add(x,23,z,13,42,13,C.stone,M.Marble) add(x,46,z,19,5,19,C.gold,M.Metal) add(x,53,z,8,9,8,C.pink,M.Neon,false) end end end -- Floating royal sigil above central plaza, assembled from rotated prisms. add(0,89,110,44,44,6,C.gold,M.Metal,false,0,0,45) add(0,89,103,27,27,4,C.violet,M.Neon,false,0,0,45) add(0,89,98,10,10,3,C.pink,M.Neon,false,0,0,45) if quality>=2 then for side=-1,1,2 do add(side*40,91,110,7,31,6,C.pearl,M.Metal,false,0,0,side*24) add(side*67,83,110,5,24,5,C.gilded,M.Metal,false,0,0,side*47) end end if quality>=3 then -- Gilded battlements along the castle facade and walls. for x=-180,180,30 do if math.abs(x)>48 then add(x,96,-130,15,11,14,C.silver,M.Marble) glow(x,102,-122,11,2,2,C.rose) end end for z=-270,-150,30 do mirror(215,103,z,15,9,15,C.silver,M.Marble) end -- Huge faceted suspended pennants along both castle wings. for _,side in ipairs({-1,1}) do for i=1,5 do local x=side*(68+i*25) add(x,62,-120,16,25,2,(i%2==0) and C.violet or C.rose,M.SmoothPlastic,false) add(x,77,-120,18,2,3,C.gold,M.Metal,false) end end for i=1,14 do local z=-285+i*35 local side=(i%2==0) and 1 or -1 local x=side*(105+(i%3)*34) add(x,2,z,10,3,10,C.gold,M.Metal) add(x,13,z,4,19,4,C.basalt,M.Metal) add(x,25,z,9,7,9,(i%2==0) and C.rose or C.cyan,M.Neon,false) end end return parts end -- LIMBO REALM: giant dark open arena with floating cubes, far mountain silhouettes, -- a dim sky presence, and a central throne platform to match the Limbo-style song vibe. local function limboRealmSpecs(quality) quality=math.clamp(math.floor(tonumber(quality) or 2),1,3) local pieces={} local M=Enum.Material local C={ abyss=Color3.fromRGB(9,9,14), floor=Color3.fromRGB(17,17,23), stone=Color3.fromRGB(31,31,43), stone2=Color3.fromRGB(46,45,61), rock=Color3.fromRGB(65,64,83), iron=Color3.fromRGB(93,90,111), silver=Color3.fromRGB(178,175,197), violet=Color3.fromRGB(137,82,225), cyan=Color3.fromRGB(72,166,213), rose=Color3.fromRGB(202,108,172), gold=Color3.fromRGB(201,166,87), void=Color3.fromRGB(11,10,17), } local cap=(quality==1 and 390) or (quality==2 and 545) or 690 local function add(x,y,z,w,h,d,color,material,collide,rx,ry,rz) if #pieces>=cap then return end pieces[#pieces+1]={ offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=color or C.stone,material=material or M.Slate, collide=collide~=false, rotation=(rx or ry or rz) and CFrame.Angles( math.rad(rx or 0),math.rad(ry or 0),math.rad(rz or 0)) or nil, } end local function both(x,y,z,w,h,d,col,mat,collide) add(-x,y,z,w,h,d,col,mat,collide) add(x,y,z,w,h,d,col,mat,collide) end local function neon(x,y,z,w,h,d,col) add(x,y,z,w,h,d,col or C.violet,M.Neon,false) end -- Limbo is a FLAT, 1,000 x 1,000-stud open plain with a dark finish. -- Thin accents sit flush with the floor instead of forming uneven terrain. add(0,0,0,1000,2,1000,C.abyss,M.Slate) add(0,1.10,0,910,.24,910,C.floor,M.SmoothPlastic) add(0,1.25,0,710,.20,710,C.stone,M.Slate) add(0,1.38,125,68,.18,610,C.floor,M.Marble) both(38,1.52,125,.8,.2,610,C.violet,M.Neon,false) if quality>=2 then for n=-4,4 do add(n*92,1.38,0,1.2,.15,750,C.stone2,M.Metal,false) add(0,1.38,n*92,750,.15,1.2,C.stone2,M.Metal,false) end end -- Outer retaining edges are low, keeping the landscape visually open. both(494,6,0,9,12,990,C.stone,M.Slate) add(0,6,494,990,12,9,C.stone,M.Slate) add(0,6,-494,990,12,9,C.stone,M.Slate) both(490,13,0,2,2,980,C.violet,M.Neon,false) neon(0,13,490,980,2,2) -- A dark sky-like canopy of scattered, high shadow forms. These are F3X -- scenery pieces, not a server Lighting.Sky replacement. add(0,330,110,290,3,115,C.void,M.SmoothPlastic,false,0,25,0) both(245,308,-35,165,2,85,C.abyss,M.SmoothPlastic,false) if quality>=2 then add(0,365,-285,220,2,115,C.void,M.SmoothPlastic,false,0,-20,0) both(295,344,242,95,3,160,C.stone,M.SmoothPlastic,false) neon(0,328,110,140,1,2,C.violet) end -- The flat avenue leads directly into a massive, OPEN-AIR dark castle. -- Overall castle footprint ~400 x 255, with a 100-stud front gate. add(0,6,-298,405,9,252,C.void,M.Marble) add(0,11,-301,374,.35,227,C.stone,M.Slate) add(0,12,-220,88,.35,136,C.rock,M.Marble) both(46,12,-222,2,.3,131,C.violet,M.Neon,false) -- Grand facade and the gap between its two wings: a walk-through gate. both(133,64,-181,138,104,18,C.stone2,M.Slate) add(0,117,-181,124,15,24,C.iron,M.Metal) add(0,131,-180,132,6,26,C.violet,M.Metal) both(58,61,-168,8,104,5,C.gold,M.Metal) both(72,60,-166,3,90,3,C.rose,M.Neon,false) -- Side ramparts and rear walls make the castle impressive at a distance. both(201,66,-292,17,118,235,C.stone2,M.Slate) both(142,64,-407,121,108,17,C.stone,M.Slate) add(0,119,-407,124,17,19,C.iron,M.Metal) add(0,131,-406,125,5,21,C.gold,M.Metal) both(202,127,-290,22,7,240,C.rock,M.Metal) both(198,139,-292,6,13,235,C.violet,M.Metal,false) -- Castle courtyard remains open, walkable, and clear of roof structures. both(157,14,-292,50,6,170,C.void,M.Marble) both(157,19,-292,43,4,162,C.rock,M.Metal) add(0,12,-300,110,.4,195,C.floor,M.Marble) both(55,12,-300,3,.3,190,C.cyan,M.Neon,false) -- A genuine SpawnLocation at the castle's interior entrance/courtyard. -- Unlike a regular Part, stock F3X's 'Spawn' type is created as a -- SpawnLocation on the server when the player has building permission. -- Raised slightly above the existing castle floor; no obstruction above. add(0,12.5,-245,22,.35,22,C.gold,M.Metal) if #pieces=2 then add(x+width*.52,38+h*.49,z,2,64,12,C.cyan,M.Neon,false) add(x-width*.52,38+h*.49,z,2,64,12,C.violet,M.Neon,false) add(x,35+h*.49,z+width*.52,12,62,2,C.rose,M.Neon,false) end if quality>=3 then add(x,62+h,z,3,12,3,C.gold,M.Neon,false) add(x,69+h,z,7,3,7,C.cyan,M.Neon,false) end end for _,x in ipairs({-184,184}) do tower(x,-185,155,36) tower(x,-390,175,40) tower(x*1.18,-300,188,42) end tower(-84,-410,141,33) tower(84,-410,141,33) -- Royal throne built INSIDE the castle, accessible from the open gate. add(0,23,-355,105,18,87,C.void,M.Marble) add(0,34,-363,81,4,55,C.gold,M.Metal) -- Evenly rising staircase ends FLUSH with the top of the throne dais. -- Previous steps were buried inside the large dais or spaced too far out. for step=1,7 do add(0,10.5+step*3,-278-step*5,100-step*7,3,7,C.rock,M.Marble) end add(0,39,-380,42,6,29,C.gold,M.Metal) add(0,62,-393,39,45,12,C.void,M.Metal) add(0,60,-384,29,37,3,C.violet,M.Neon,false) both(26,47,-385,8,22,29,C.gold,M.Metal) both(19,88,-394,7,22,9,C.gold,M.Metal) add(0,96,-394,12,25,10,C.gold,M.Metal) neon(0,115,-393,15,5,8,C.violet) if quality>=2 then for side=-1,1,2 do for i=0,4 do add(side*(37+i*10),62-i*2,-407,4,31-i*4,5, (i%2==0) and C.silver or C.gold,M.Metal,false,0,0,side*(20+i*7)) end end end -- Windows, crenellations, side spires and castle approach illumination. for _,side in ipairs({-1,1}) do for i=1,(quality==1 and 5 or 9) do local x=side*(76+i*12) if x<195 and x>-195 then add(x,124,-177,6,13,8,C.iron,M.Metal) end end for _,z in ipairs({-148,-90,-25,40,105,170,235,300,365}) do add(side*47,10,z,4,18,4,C.stone2,M.Metal) neon(side*47,22,z,9,6,9,C.violet) end if quality>=2 then for _,z in ipairs({-223,-265,-307,-349}) do add(side*201,130,z,15,9,19,C.iron,M.Metal) neon(side*203,138,z,5,2,12,C.cyan) end end end if quality>=3 then for x=-160,160,32 do if math.abs(x)>=75 then add(x,127,-181,16,11,19,C.rock,M.Marble) neon(x,135,-171,12,2,3,C.rose) end end for i=1,10 do local x=(((i*43)%310)-155) add(x,30,-290,8,32,8,C.iron,M.Metal) neon(x,49,-290,11,6,11,C.cyan) end end -- Mountains remain FAR OUTSIDE the castle and spawn area: 445-485 studs. -- Layered dark jagged silhouettes, not bumps under players' feet. for _,z in ipairs({-471,471}) do for i=-6,6 do local x=i*70+((i%2==0) and 0 or 14) local h=59+((i*i+7)%5)*20+(quality-1)*10 add(x,h/2+6,z,47,h,30,C.stone,M.Slate,false,0,(i*13)%19,(i%2==0) and 10 or -10) if quality>=2 then add(x,h+8,z,24,h*.4,18,C.rock,M.Slate,false,0,(i*17)%25,(i%2==0) and -13 or 13) end end end for _,x in ipairs({-475,475}) do for i=-5,5 do local z=i*78 local h=55+((i*i+9)%4)*19+(quality-1)*12 add(x,h/2+8,z,28,h,53,C.stone,M.Slate,false,(i%2==0) and -10 or 10,(i*13)%20,0) if quality>=3 then add(x,h+5,z,17,h*.36,27,C.rock,M.Slate,false,(i%2==0) and 12 or -12,0,0) end end end -- Suspended cubes across the free space, avoiding the throne and gate. local cubeCount=(quality==1 and 66) or (quality==2 and 120) or 166 for i=1,cubeCount do local x=((i*137)%868)-434 local z=((i*193)%868)-434 -- Keep ALL castle interiors clear, including the throne and -- SpawnLocation. Relocate cubes beside the castle rather than -- allowing a rotating block to intersect a tower or royal seat. if math.abs(x)<245 and z<-150 then x=((x<0) and -1 or 1)*(278+math.abs(x)*.5) end local y=26+((i*29)%186) local size=7+((i*17)%17) local color=(i%6==0 and C.cyan) or (i%4==0 and C.rose) or (i%3==0 and C.silver) or C.violet add(x,y,z,size,size,size,color,(i%2==0) and M.Neon or M.Metal, false,((i*11)%20)-10,(i*37)%180,((i*19)%24)-12) if quality>=2 and i%5==0 then neon(x,y-9,z,3,3,3,C.cyan) end end -- Broken floating columns and cube stacks around the open royal approach. for _,x in ipairs({-270,-180,180,270}) do for _,z in ipairs({-90,35,160,285}) do local h=26+((math.abs(x)+math.abs(z))%4)*12 add(x,h/2+2,z,14,h,14,C.stone2,M.Metal) neon(x,h+4,z,20,3,20,C.violet) if quality>=2 then add(x,h+20,z,10,10,10,C.silver,M.Glass,false,0,45,0) end end end return pieces end -- COLOSSAL KINGDOM: 5,000 x 5,000 stud open plains with a roofed, walkable castle. -- All pieces are generated from standard F3X-created parts; textures come from -- Roblox's built-in textured Materials (Slate, Grass, Brick, WoodPlanks, etc.). -- Each grass tile is 1000 studs across; every part is under 2048 studs per axis. local function colossalKingdomSpecs(quality) quality=math.clamp(math.floor(tonumber(quality) or 2),1,3) local parts={} local M=Enum.Material local C={ field=Color3.fromRGB(63,88,62),field2=Color3.fromRGB(70,96,68), moss=Color3.fromRGB(42,65,49),grass=Color3.fromRGB(83,116,75), earth=Color3.fromRGB(82,78,65),stone=Color3.fromRGB(95,98,107), lightStone=Color3.fromRGB(160,160,169),marble=Color3.fromRGB(210,205,205), basalt=Color3.fromRGB(49,52,67),dark=Color3.fromRGB(25,28,40), roof=Color3.fromRGB(48,48,66),slate=Color3.fromRGB(73,76,96), wood=Color3.fromRGB(94,59,43),wood2=Color3.fromRGB(133,93,61), gold=Color3.fromRGB(215,166,82),pearl=Color3.fromRGB(238,228,206), rose=Color3.fromRGB(229,141,184),violet=Color3.fromRGB(137,91,189), cyan=Color3.fromRGB(112,193,211),glass=Color3.fromRGB(91,154,167), mountain=Color3.fromRGB(67,68,78),mountain2=Color3.fromRGB(88,88,98), } local hardLimit=quality==1 and 980 or (quality==2 and 1320 or 1600) local function add(x,y,z,w,h,d,col,mat,collide,rx,ry,rz) if #parts>=hardLimit then return end parts[#parts+1]={ offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=col or C.stone,material=mat or M.SmoothPlastic, collide=collide~=false, rotation=(rx or ry or rz) and CFrame.Angles( math.rad(rx or 0),math.rad(ry or 0),math.rad(rz or 0)) or nil, } end local function mirrorX(x,y,z,w,h,d,col,mat,collide,rx,ry,rz) add(-x,y,z,w,h,d,col,mat,collide,rx,ry,rz) add( x,y,z,w,h,d,col,mat,collide,rx,ry,rz) end local function glow(x,y,z,w,h,d,col) add(x,y,z,w,h,d,col or C.gold,M.Neon,false) end local function column(x,z,height,width) width=width or 10 add(x,height/2+8,z,width,height,width,C.lightStone,M.Marble) add(x,9,z,width+5,5,width+5,C.basalt,M.Slate) add(x,height+8,z,width+7,5,width+7,C.gold,M.Metal) end local function stairRun(x0,y0,z0,steps,dir,runWidth,rise,depth,col,mat) for i=1,steps do local zz=z0+(i-1)*dir*depth add(x0,y0+i*rise,zz,runWidth,rise*2,depth,col or C.lightStone,mat or M.Marble) end end -- True 5000 x 5000 plains. for ix=-2,2 do for iz=-2,2 do add(ix*1000,-6,iz*1000,1000,12,1000, ((ix+iz)%2==0) and C.field or C.field2,M.Grass) end end for i=1,(quality==1 and 34 or quality==2 and 70 or 108) do local x=((i*947)%4500)-2250 local z=((i*613)%4480)-2240 if math.abs(x)>920 or z>420 or z< -1380 then add(x,.12,z,25+(i%6)*15,.2,30+(i%7)*11, (i%3==0) and C.moss or C.grass,M.Grass,false,0,(i*33)%90,0) end end -- Massive four-floor castle for big players. local castleW,castleD=1540,1320 local rearZ=-560 add(0,4,rearZ,castleW,8,castleD,C.basalt,M.Cobblestone) add(0,8,rearZ,1490,1.2,1270,C.pearl,M.Marble,false) add(0,7.6,170,360,.45,340,C.lightStone,M.Cobblestone,false) add(0,8.1,170,90,.45,420,C.gold,M.Metal,false) mirrorX(126,8.1,170,2,.45,420,C.rose,M.Neon,false) -- Exterior walls and huge front gate. local wallH=188 mirrorX(770,wallH/2+8,rearZ,20,wallH,1260,C.stone,M.Brick) add(0,wallH/2+8,-1200,1520,wallH,20,C.stone,M.Brick) mirrorX(470,wallH/2+8,100,540,wallH,20,C.stone,M.Brick) add(0,170,100,420,44,20,C.lightStone,M.Brick) mirrorX(225,wallH/2+4,100,12,wallH+8,28,C.basalt,M.Slate) mirrorX(210,195,100,26,12,30,C.gold,M.Metal) glow(0,200,100,465,5,10,C.rose) -- Four main floor slabs / walkways. local floors={8,48,88,128} local innerW,innerD=1450,1180 for idx,y in ipairs(floors) do add(0,y,rearZ,innerW,2,innerD,C.lightStone,(idx%2==0) and M.Marble or M.Cobblestone) if idx<4 then -- central atrium cut-out for grandeur on lower floors add(0,y+0.2,-310,420,2,360,C.basalt,M.SmoothPlastic,false) end end -- rear throne super-floor, larger and taller. add(0,128,-930,690,2,265,C.basalt,M.Marble) add(0,130,-930,560,.35,180,C.pearl,M.Marble,false) -- Interior support walls creating smaller rooms for regular players. for side=-1,1,2 do local sx=side*250 add(sx,68,-300,16,118,740,C.lightStone,M.Brick) add(sx,68,-810,16,118,305,C.lightStone,M.Brick) for _,z in ipairs({-110,-330,-560,-780,-995}) do add(side*510,68,z,210,118,14,C.stone,M.Brick) add(side*695,68,z,145,118,14,C.stone,M.Brick) if quality>=2 then add(side*602,121,z,70,14,14,C.gold,M.Metal) end end end -- Central giant hall walling, open enough for big players. add(-370,76,-765,14,146,660,C.lightStone,M.Brick) add( 370,76,-765,14,146,660,C.lightStone,M.Brick) add(0,76,-655,740,146,14,C.stone,M.Brick) add(0,76,-1095,740,146,14,C.stone,M.Brick) add(0,76,-335,650,146,14,C.stone,M.Brick) add(0,152,-785,455,6,615,C.gold,M.Metal,false) add(0,170,-785,425,5,585,C.pearl,M.Marble,false) -- Grand staircases to upper levels. stairRun(0,8,40,14,-1,220,3,18,C.lightStone,M.Marble) add(0,56,-215,245,3,42,C.gold,M.Metal) stairRun(0,48,-235,12,-1,190,3,18,C.lightStone,M.Marble) add(0,94,-438,208,3,34,C.gold,M.Metal) stairRun(0,88,-458,12,-1,165,3,18,C.lightStone,M.Marble) add(0,133,-662,180,3,34,C.gold,M.Metal) -- Walkway edges / balconies for each floor. for _,y in ipairs({48,88,128}) do add(0,y+5,-300,1120,2,14,C.gold,M.Metal,false) add(0,y+5,-1010,1120,2,14,C.gold,M.Metal,false) mirrorX(560,y+5,-650,14,2,690,C.gold,M.Metal,false) if quality>=2 then for x=-520,520,80 do add(x,y+10,-300,10,10,4,C.lightStone,M.Brick) add(x,y+10,-1010,10,10,4,C.lightStone,M.Brick) end for z=-970,-330,80 do mirrorX(560,y+10,z,4,10,10,C.lightStone,M.Brick) end end end -- Huge throne for giant players on floor 4. add(0,137,-1080,260,14,180,C.basalt,M.Marble) add(0,146,-1108,190,8,110,C.gold,M.Metal) for i=1,7 do add(0,130+i*3.5,-950-i*18,250-i*18,6,18,C.lightStone,M.Marble) end add(0,164,-1130,72,12,48,C.gold,M.Metal) add(0,217,-1168,78,92,22,C.dark,M.Metal) add(0,217,-1152,58,70,4,C.violet,M.SmoothPlastic,false) mirrorX(48,186,-1158,16,44,40,C.gold,M.Metal) mirrorX(36,240,-1170,15,28,18,C.gold,M.Metal) add(0,260,-1169,24,42,18,C.pearl,M.Metal) glow(0,255,-1155,58,5,5,C.rose) if quality>=2 then for side=-1,1,2 do for i=0,7 do add(side*(52+i*14),212-i*4,-1182,6,38-i*4,6, (i%2==0) and C.gold or C.pearl,M.Metal,false,0,0,side*(18+i*5)) end end end -- Multi-room lower floors for small players. -- West wing: dining, kitchen, treasury. for _,z in ipairs({-180,-360}) do add(-545,15,z,270,10,38,C.wood,M.WoodPlanks) add(-545,20,z,245,4,28,C.wood2,M.Wood) for k=-4,4 do local px=-545+k*28 add(px,13,z-48,22,10,22,C.wood2,M.WoodPlanks) add(px,13,z+48,22,10,22,C.wood2,M.WoodPlanks) if quality>=2 then add(px,23,z-57,20,18,5,C.wood,M.WoodPlanks) add(px,23,z+57,20,18,5,C.wood,M.WoodPlanks) end end end add(-545,9,-95,300,1.2,26,C.rose,M.Fabric,false) for _,x in ipairs({-690,-600,-510,-420}) do add(x,18,-560,56,20,40,C.stone,M.Brick) add(x,31,-560,60,4,46,C.lightStone,M.Marble) if quality>=2 then glow(x,24,-536,24,8,2,C.rose) end end add(-550,14,-735,250,12,48,C.wood2,M.WoodPlanks) add(-550,9,-735,228,10,28,C.wood,M.Wood) for _,z in ipairs({-905,-985}) do for _,x in ipairs({-675,-590,-505,-420}) do add(x,16,z,58,12,40,C.wood,M.WoodPlanks) add(x,26,z,60,6,42,C.gold,M.Metal) if quality>=2 then add(x,34,z,28,8,28,C.gold,M.Metal,false,0,45,0) end end end -- East wing: library, armory, war room. for _,x in ipairs({420,510,600,690}) do for _,z in ipairs({-165,-245,-325}) do add(x,40,z,34,68,18,C.wood,M.WoodPlanks) add(x,22,z+8,35,6,20,C.gold,M.Metal,false) if quality>=2 then for j=1,4 do add(x,15+j*13,z+10,27,8,3,(j%2==0) and C.violet or C.cyan,M.SmoothPlastic,false) end end end end add(550,14,-245,160,10,58,C.wood2,M.WoodPlanks) for _,x in ipairs({455,560,665}) do add(x,14,-560,62,14,40,C.wood,M.WoodPlanks) if quality>=2 then for _,z in ipairs({-485,-520,-555,-590}) do add(x,54,z,3,58,3,C.lightStone,M.Metal,false) add(x,84,z,20,8,4,C.gold,M.Metal,false) end end end add(555,12,-485,148,8,36,C.wood2,M.WoodPlanks) add(550,16,-940,260,14,92,C.wood2,M.WoodPlanks) add(550,9,-940,220,14,56,C.wood,M.Wood) for k=-4,4 do add(550+k*28,13,-868,22,10,22,C.wood,M.WoodPlanks) add(550+k*28,13,-1012,22,10,22,C.wood,M.WoodPlanks) end -- Massive central royal hall details and columns for all floors. for _,z in ipairs({-245,-430,-615,-800,-980}) do for _,x in ipairs({-178,178}) do column(x,z,116,12) end end for _,z in ipairs({-295,-525,-750,-960}) do add(0,142,z,5,52,5,C.gold,M.Metal,false) add(0,114,z,38,8,38,C.gold,M.Metal,false) if quality>=2 then for _,dx in ipairs({-16,0,16}) do glow(dx,108,z,6,14,6,C.pearl) end end end -- Windows, details and banners. for _,x in ipairs({-630,-470,-310,310,470,630}) do for _,z in ipairs({65,-1180}) do add(x,98,z,34,60,4,C.glass,M.Glass,false) add(x,130,z,38,5,6,C.gold,M.Metal,false) end end for _,z in ipairs({-170,-350,-530,-710,-890,-1070}) do mirrorX(772,96,z,4,64,34,C.glass,M.Glass,false) mirrorX(774,132,z,8,6,40,C.gold,M.Metal,false) end if quality>=2 then for x=-700,700,100 do add(x,201,-1200,20,14,20,C.stone,M.Brick) end for z=-1120,40,90 do mirrorX(240,148,z,12,16,6,C.gold,M.Metal,false) mirrorX(728,175,z,21,12,18,C.lightStone,M.Brick) end end if quality>=3 then for z=-1030,-210,42 do for _,x in ipairs({-148,148}) do add(x,8.8,z,22,.35,14,(z%2==0) and C.gold or C.rose,M.Marble,false,0,42,0) end end for _,x in ipairs({-610,-470,-330,330,470,610}) do for _,z in ipairs({-245,-555,-915}) do add(x,163,z,15,6,60,C.gold,M.Metal,false) add(x,151,z,31,42,2,C.violet,M.Fabric,false) end end for _,z in ipairs({-245,-430,-615,-800,-980}) do for _,x in ipairs({-178,178}) do glow(x,75,z,8,18,8,C.rose) end end end -- Enormous roof and top structures. add(150,192,-545,440,12,930,C.roof,M.Slate,true,0,0,-13) add(-150,192,-545,440,12,930,C.roof,M.Slate,true,0,0,13) mirrorX(500,176,-545,470,11,930,C.slate,M.Slate,true) add(0,238,-545,38,8,960,C.gold,M.Metal) if quality>=2 then for z=-1120,20,84 do mirrorX(505,182,z,430,1.4,2,C.lightStone,M.Slate,false) add(0,240,z,34,2,4,C.pearl,M.Metal,false) end end -- More and taller towers. local function tower(x,z,h) add(x,13,z,118,22,118,C.basalt,M.Cobblestone) add(x,24+h/2,z,92,h,92,C.stone,M.Brick) add(x,26+h,z,120,8,120,C.lightStone,M.Slate) add(x,44+h,z,102,28,102,C.roof,M.Slate) add(x,62+h,z,64,10,64,C.gold,M.Metal) add(x,82+h,z,32,36,32,C.basalt,M.Slate) add(x,103+h,z,20,7,20,C.rose,M.Neon,false) if quality>=2 then for side=-1,1,2 do add(x+side*48,58+h*.5,z,3,33,16,C.gold,M.Metal,false) add(x,58+h*.5,z+side*48,16,33,3,C.gold,M.Metal,false) end end end for _,x in ipairs({-770,770}) do tower(x,100,210) tower(x,-1210,245) tower(x,-560,186) end tower(0,100,228) tower(0,-1210,275) -- Road out into the plains. for k=0,5 do local z=400+k*420 add(0,.5,z,120,1,400,C.lightStone,M.Cobblestone) mirrorX(62,1.3,z,4,.6,400,C.gold,M.Metal,false) end for side=-1,1,2 do add(side*245,16,28,66,26,66,C.basalt,M.Slate) add(side*245,52,28,42,48,36,C.lightStone,M.Marble) add(side*245,88,28,36,28,36,C.gold,M.Metal) add(side*245,107,28,44,6,34,C.dark,M.Metal) for _,z in ipairs({-8,-58,-110,-162}) do add(side*148,28,z,8,42,8,C.gold,M.Metal) glow(side*148,55,z,15,9,15,C.rose) end end if quality>=2 then for side=-1,1,2 do for _,z in ipairs({18,-40,-98,-156}) do add(side*395,16,z,8,19,8,C.stone,M.Brick) glow(side*395,28,z,13,7,13,C.gold) end end end -- Mountains around the edge only. local ridgeCount=(quality==1 and 10) or (quality==2 and 14) or 18 for edge=1,4 do for i=1,ridgeCount do local v=-2310+(i-.5)*(4620/ridgeCount) local shift=(((i*13+edge*7)%5)-2)*25 local x,z if edge==1 then x,z=v,2300+shift elseif edge==2 then x,z=v,-2300+shift elseif edge==3 then x,z=2300+shift,v else x,z=-2300+shift,v end local ht=220+((i*43+edge*71)%5)*78 local wide=150+((i*17+edge*29)%4)*34 add(x,ht*.24,z,wide,ht*.48,wide,C.mountain,M.Rock,true) add(x,ht*.62,z,wide*.74,ht*.39,wide*.74,C.mountain2,M.Slate,true) add(x,ht*.87,z,wide*.46,ht*.2,wide*.46,C.stone,M.Rock,true) if quality>=2 then add(x,ht*1.02,z,wide*.23,ht*.13,wide*.23,C.lightStone,M.Slate,true) end end end return parts end -- FUN MAP BLUEPRINTS (F3X only): geometry is replicated by ordinary authorized -- build calls. Checkpoint / timer rules belong to the local Pixel GUI player; -- there is no hidden server script or custom remote in these presets. local function funMapSpecs(theme,quality) local parts={} local M=Enum.Material local C={ slate=Color3.fromRGB(43,48,68),stone=Color3.fromRGB(104,113,142), pink=Color3.fromRGB(240,132,193),violet=Color3.fromRGB(132,100,238), cyan=Color3.fromRGB(72,217,244),lime=Color3.fromRGB(132,250,150), red=Color3.fromRGB(244,73,83),gold=Color3.fromRGB(255,196,85), dark=Color3.fromRGB(19,25,38),white=Color3.fromRGB(238,234,249), lava=Color3.fromRGB(225,69,37),purple=Color3.fromRGB(99,65,164), } local function add(x,y,z,w,h,d,col,material,collide,role,id,ry) parts[#parts+1]={ offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=col or C.stone,material=material or M.SmoothPlastic, collide=collide~=false,funRole=role,funId=id, rotation=ry and CFrame.Angles(0,math.rad(ry),0) or nil, } end local function highlight(x,y,z,w,d,color) add(x,y,z,w,.65,d,color or C.cyan,M.Neon,false) end local function podium(x,y,z,w,d,role,id,color) add(x,y,z,w,2,d,color or C.slate,M.Slate,true,role,id) if quality>=2 then -- Purely decorative thin crown, noncollidable, not a trigger. highlight(x,y+1.25,z,w-2,d-2, role=='finish' and C.lime or role=='checkpoint' and C.gold or C.cyan) end end if theme=='SkySprintObby' then add(0,-2,172,110,5,70,C.dark,M.Slate,true) for i=1,28 do local x=math.sin(i*.62)*29 local z=151-(i-1)*19 local y=5+(i-1)*2.5 local role,id if i==1 then role='start' elseif i==28 then role='finish' elseif i==6 then role='checkpoint';id=1 elseif i==12 then role='checkpoint';id=2 elseif i==19 then role='checkpoint';id=3 elseif i==24 then role='checkpoint';id=4 end podium(x,y,z,(i==1 or i==28) and 30 or 21, (i==1 or i==28) and 26 or 20,role,id, i%3==0 and C.purple or C.slate) if i%5==0 and not role then add(x+5,y+3,z,2,5,17,C.red,M.Neon,false,'hazard') end if quality>=2 then add(x,y-3,z,5,4,5,C.dark,M.Metal,false) if i%3==0 then highlight(x-9,y+2,z,2,13,C.pink) end end if quality>=3 and i%2==0 then add(x-10,y+4,z,1,8,1,C.gold,M.Metal,false) add(x-10,y+9,z,3,3,3,C.cyan,M.Neon,false) end end -- Visible path guides that do not replace actual jumps. for i=1,8 do add(-66,7+i*9,150-i*57,3,3,3,C.violet,M.Neon,false) end elseif theme=='TowerTrials' then add(0,0,0,215,7,215,C.dark,M.Slate,true) add(0,108,0,12,215,12,C.stone,M.Marble,true) for i=1,45 do local a=(i-1)*math.pi/7 local x,z=math.cos(a)*62,math.sin(a)*62 local y=8+(i-1)*4.4 local role,id if i==1 then role='start' elseif i==45 then role='finish' elseif i==9 then role='checkpoint';id=1 elseif i==18 then role='checkpoint';id=2 elseif i==27 then role='checkpoint';id=3 elseif i==36 then role='checkpoint';id=4 end podium(x,y,z,29,27,role,id, (i%4==0) and C.purple or C.slate) if quality>=2 and i%3==0 then add(x,y-8,z,5,13,5,C.gold,M.Metal,false) highlight(x,y+1.4,z,4,22,C.violet) end if i%8==5 and not role then -- Short hazard on the edge of a landing, must be avoided. add(x+9,y+2,z,3,4,21,C.red,M.Neon,false,'hazard') end if quality>=3 and i%5==0 then add(x,y+8,z,1,12,1,C.cyan,M.Neon,false) end end add(0,222,0,155,5,155,C.purple,M.Slate,true) add(0,226,0,122,1,122,C.dark,M.Slate,true) for k=0,7 do local a=k*math.pi/4 local x,z=math.cos(a)*91,math.sin(a)*91 add(x,113,z,5,221,5,C.stone,M.Metal,true) if quality>=2 then highlight(x,224,z,10,10,C.gold) end end elseif theme=='LavaEscape' then -- Lava is visually real F3X geometry; only local challenge logic resets -- a player touching it. The script never damages other players. add(0,-6,-100,228,8,690,C.lava,M.CrackedLava,true,'hazard') add(0,-1.5,-100,225,1,686,C.red,M.Neon,false,'hazard') for i=1,26 do local x=math.sin(i*.53)*31 local z=148-(i-1)*20 local y=7+((i%5)==0 and 2 or 0) local role,id if i==1 then role='start' elseif i==26 then role='finish' elseif i==7 then role='checkpoint';id=1 elseif i==13 then role='checkpoint';id=2 elseif i==19 then role='checkpoint';id=3 elseif i==23 then role='checkpoint';id=4 end podium(x,y,z,(i==1 or i==26) and 32 or 20, (i==1 or i==26) and 28 or 20,role,id, i%4==0 and C.stone or C.dark) if i%6==4 and not role then add(x+5,y+2,z,2,3,15,C.red,M.Neon,false,'hazard') end if quality>=2 then add(x,y-5,z,6,5,6,C.slate,M.Basalt,true) if i%4==1 then highlight(x-10,y+2,z,3,13,C.gold) end end end for i=0,13 do local z=155-i*42 for s=-1,1,2 do add(s*105,16,z,18,29,26,C.dark,M.Basalt,true) if quality>=2 then highlight(s*105,32,z,10,12,i%2==0 and C.lava or C.gold) end if quality>=3 and i%2==0 then add(s*105,40,z,6,12,6,C.gold,M.Metal,false) highlight(s*105,47,z,10,10,C.red) end end end elseif theme=='NeonRaceway' then -- An on-foot track with ordered checkpoints (no vehicle required). add(0,-10,0,530,13,405,C.dark,M.Slate,true) for i=1,40 do local a=math.pi/2+(i-1)*math.pi*2/40 local x,z=math.cos(a)*204,math.sin(a)*136 local role,id if i==1 then role='start' elseif i==10 then role='checkpoint';id=1 elseif i==20 then role='checkpoint';id=2 elseif i==30 then role='checkpoint';id=3 elseif i==37 then role='checkpoint';id=4 end -- Overlapping track segments make the running surface continuous. add(x,2,z,48,3,48,C.slate,M.SmoothPlastic,true,role,id) if quality>=2 and i%2==0 then highlight(x,4,z,4,13,i%4==0 and C.pink or C.cyan) end if quality>=2 and i%4==0 then add(x,9,z,3,10,3,C.gold,M.Metal,false) end end -- Finish line shares the starting position but requires every checkpoint. add(0,4,136,44,1,10,C.lime,M.Neon,false,'finish') add(0,5,136,3,1,44,C.white,M.Neon,false) for i=1,18 do local a=i*math.pi/9 local x,z=math.cos(a)*260,math.sin(a)*182 add(x,14,z,4,26,4,C.dark,M.Metal,true) if quality>=2 then highlight(x,29,z,8,8,C.pink) end if quality>=3 and i%3==0 then add(x,34,z,3,11,3,C.gold,M.Metal,false) highlight(x,41,z,10,10,C.cyan) end end elseif theme=='VoidDropper' then -- Elevated jump platform and an open 190-stud chute. add(0,-4,0,190,8,190,C.dark,M.Slate,true) add(0,-.2,0,110,1,110,C.purple,M.Neon,false) podium(0,2,0,66,66,'finish',nil,C.dark) podium(-54,310,40,70,65,'start',nil,C.slate) add(-54,306,40,12,7,12,C.gold,M.Metal,false) for s=-1,1,2 do add(s*94,153,0,7,302,192,C.stone,M.Glass,true) add(0,153,s*94,192,302,7,C.stone,M.Glass,true) end for i=1,10 do local y=282-(i-1)*26 local x=(i%2==0) and 29 or -29 local z=((i%3)-1)*26 add(x,y,z,69,7,19,C.red,M.Neon,false,'hazard') if quality>=2 then add(-x*.6,y-11,-z,16,5,25,C.violet,M.Slate,true) highlight(-x*.6,y-7,-z,14,23,C.cyan) end if quality>=3 then add(z,y-10,x,5,5,5,C.gold,M.Neon,false) end end for i=1,8 do local a=i*math.pi/4 local x,z=math.cos(a)*80,math.sin(a)*80 add(x,5,z,5,8,5,C.cyan,M.Neon,false) end end return parts end mapBlueprint = function(theme, quality) -- A physical sign near the entrance of every realm, built and tracked like any other part. -- Back is the face looking toward the approaching player (+Z in realm space). local function appendRealmSign(specs, theme) local x = ((theme=='SkySprintObby' or theme=='TowerTrials' or theme=='LavaEscape' or theme=='NeonRaceway' or theme=='VoidDropper') and 110) or (theme=='ColossalKingdom' and 205) or (theme=='AscendantCitadel' and 75) or (theme=='LimboRealm' and 112) or 27 local z = ((theme=='SkySprintObby' or theme=='LavaEscape' or theme=='NeonRaceway') and 185) or (theme=='TowerTrials' and 115) or (theme=='VoidDropper' and 40) or (theme=='ColossalKingdom' and 150) or (theme=='AscendantCitadel' and 268) or (theme=='LimboRealm' and 416) or (theme=='PIXEL' and 50) or ((theme=='VOID' or theme=='GOLD') and 57) or 65 local baseColor=Color3.fromRGB(29,28,35) local trimColor=Color3.fromRGB(233,160,195) local postColor=Color3.fromRGB(91,88,99) local function add(dx,y,w,h,d,color,material,decal) specs[#specs+1]={ offset=Vector3.new(x+dx,y,z), size=Vector3.new(w,h,d), color=color, material=material, collide=false, signDecal=(decal==true), } end -- Dark sign panel, two posts, and rose metal trim. Keeps walkways clear. add(-8.7,7,1,13,1.1,postColor,Enum.Material.Metal) add( 8.7,7,1,13,1.1,postColor,Enum.Material.Metal) add( 0,11.5,18,10,0.75,baseColor,Enum.Material.SmoothPlastic,true) add( 0,16.8,19.5,0.65,1.2,trimColor,Enum.Material.Metal) add( 0, 6.2,19.5,0.65,1.2,trimColor,Enum.Material.Metal) end quality=math.clamp(math.floor(tonumber(quality) or 2),1,3) if theme=='SkySprintObby' or theme=='TowerTrials' or theme=='LavaEscape' or theme=='NeonRaceway' or theme=='VoidDropper' then local parts=funMapSpecs(theme,quality) appendRealmSign(parts,theme) return parts end if theme=='ColossalKingdom' then local parts=colossalKingdomSpecs(quality) appendRealmSign(parts,theme) return parts end if theme=='AscendantCitadel' then local parts=ascendantCitadelSpecs(quality) appendRealmSign(parts,theme) return parts end if theme=='LimboRealm' then local parts=limboRealmSpecs(quality) appendRealmSign(parts,theme) return parts end if theme=='PIXEL' then local parts=realmSpecs('PIXEL',quality>=2) if quality>=3 then local accent=Color3.fromRGB(241,126,188) local gold=Color3.fromRGB(235,179,67) for i=-4,4 do parts[#parts+1]={offset=Vector3.new(i*9,2,27),size=Vector3.new(2,.4,24),color=accent,material=Enum.Material.Neon,collide=false} parts[#parts+1]={offset=Vector3.new(i*9,36,-2),size=Vector3.new(1,1,70),color=gold,material=Enum.Material.Metal,collide=false} end end appendRealmSign(parts,theme) return parts end local parts=expandedMapSpecs(theme,quality) appendRealmSign(parts,theme) return parts end end -- castle generator / mapBlueprint scope -- Only the actual experience owner may replace unrelated spawn points. -- For group-owned places, Roblox reports the group owner at rank 255. local function isExperienceOwner() if game.CreatorType==Enum.CreatorType.User then return game.CreatorId==player.UserId end if game.CreatorType==Enum.CreatorType.Group then local ok,rank=pcall(function() return player:GetRankInGroup(game.CreatorId) end) return ok and rank==255 end return false end -- F3X supports bulk SyncResize, SyncColor, SyncMaterial and SyncCollision -- updates for DISTINCT parts. Small chunks reduce request count without -- overwhelming the server with a single very large remote invocation. local function createRealm(theme, detailed, options) options=options or {} local replacing=options.replace==true local quality=math.clamp(math.floor(tonumber(options.quality) or (detailed and 3 or 2)),1,3) if busy or realmBusy then return say('Finish the current BTools operation first.') end if os.clock()-lastRealmBuild0 and not replacing then return say('Remove your current realm before building another.') end local tool,endpoint,problem=detectBuildTool() if not endpoint then return say(problem or 'No F3X tool with CreatePart found.') end local char=player.Character local hrp=char and char:FindFirstChild('HumanoidRootPart') if not hrp then return say('Spawn your character before building.') end local specs=mapBlueprint(theme, quality) -- When building at ground level, restore original terrain visibility first. if not options.isolate and originalView.active then restoreOriginalWorld() end local look=hrp.CFrame.LookVector local flat=Vector3.new(look.X,0,look.Z) if flat.Magnitude<0.01 then flat=Vector3.new(0,0,-1) end flat=flat.Unit -- User approaches through the opening on the near (+Z) side of the hall. local distance=(theme=='ColossalKingdom' and 2580) or (theme=='AscendantCitadel' and 335) or (theme=='LimboRealm' and 495) or (theme=='PIXEL' and 59 or 82) local origin=hrp.Position+flat*distance+Vector3.new(0,-3,0) if options.isolate then -- An isolated building location prevents overlapping the game's original map. -- The old world remains untouched; this is an alternative, not a wipe. origin=origin+Vector3.new(0,(theme=='ColossalKingdom' and 1200) or (theme=='AscendantCitadel' and 650) or (theme=='LimboRealm' and 850) or 400,0) end local base=CFrame.lookAt(origin,origin+flat) local labelMode=options.label or (theme=='PIXEL' and (quality>=2 and 'Detailed Pixel Hall' or 'Pixel Hall') or (theme=='LimboRealm' and 'Limbo Realm') or theme) stopRealmAnimation(true) realmAnimation.objects={} realmAnimation.theme=theme realmRegistry.cancelBuild=false realmRegistry.funGame=nil -- a new build invalidates any earlier local challenge realmBusy=true;lastRealmBuild=os.clock() lastRealmResult={ok=false,detail='Building'} say('Building '..labelMode..' with F3X ('..#specs..' pieces)...',true) task.spawn(function() local signConfirmed=0 local signIssue=nil local spawnPart=nil local removedOldSpawns=0 local remainingOldSpawns=0 local spawnCleanupNotice='' -- Measured, approximate progress/ETA. The countdown uses the actual -- completed F3X requests, not a promise about server response times. local styleBatchSize=8 local nonCollide=0 for _,partSpec in ipairs(specs) do if partSpec.collide==false then nonCollide=nonCollide+1 end end local styleBatches=math.ceil(#specs/styleBatchSize)*3+ math.ceil(nonCollide/styleBatchSize) local totalOperations=#specs+styleBatches+2 -- include two sign faces local completedOperations=0 local creationCompleted=0 local stylingCompleted=0 local startedAt=os.clock() local styleStartedAt=nil local lastReported=-1e9 local function timeLabel(seconds) seconds=math.max(0,math.floor(seconds+0.5)) if seconds>=3600 then return string.format('%dh %02dm',math.floor(seconds/3600),math.floor(seconds/60)%60) end if seconds>=60 then return string.format('%dm %02ds',math.floor(seconds/60),seconds%60) end return tostring(seconds)..'s' end local function reportBuild(phase,force) local now=os.clock() if not force and now-lastReported<1.25 then return end lastReported=now local eta='calculating' if creationCompleted>=8 then local buildAvg=(now-startedAt)/creationCompleted local remainingCreation=(#specs-creationCompleted)*buildAvg local remainingStyle=0 if styleStartedAt and stylingCompleted>=3 then local styleAvg=(now-styleStartedAt)/stylingCompleted remainingStyle=(styleBatches-stylingCompleted)*styleAvg else remainingStyle=styleBatches*math.max(.18,config.f3xDelay+.12) end eta=timeLabel(remainingCreation+remainingStyle) end local pct=math.floor(math.clamp(completedOperations/math.max(1,totalOperations),0,1)*100) local message=labelMode..' | '..pct..'% | '..phase..' | ETA ~ '..eta if type(options.onProgress)=='function' then pcall(options.onProgress,message) end if gui.Parent then say(message,true) end end local ok,err=pcall(function() local allowedToReplaceSpawns=(theme=='LimboRealm') and isExperienceOwner() local oldSpawns={} if allowedToReplaceSpawns then for _,item in ipairs(workspace:GetDescendants()) do if item:IsA('SpawnLocation') then oldSpawns[#oldSpawns+1]=item end end end if replacing then local previous=liveRealmParts() if #previous>0 then reportBuild('Clearing previous realm',true) end if #previous>0 then say('Removing '..#previous..' previous Pixel GUI map parts...',true) -- Removing hundreds of parts in one call can hit server limits. -- Chunk only our own references; NEVER gather unrelated Workspace objects. for first=1,#previous,16 do local batch={} for i=first,math.min(first+15,#previous) do batch[#batch+1]=previous[i] end local response=endpoint:InvokeServer('Remove',batch) if response==false then error('F3X rejected cleanup batch starting at '..first) end task.wait(math.max(0.10,config.f3xDelay)) end local started=os.clock() while #liveRealmParts()>0 and os.clock()-started<3 do task.wait(.15) end if #liveRealmParts()>0 then error('Old Pixel GUI map remains: '..#liveRealmParts()..' parts (F3X cleanup refused or delayed)') end end end -- Clear-time is excluded from the construction ETA. startedAt=os.clock() reportBuild('Creating 0/'..#specs..' parts',true) realmOrigin=origin realmRegistry.origin=origin local resize,color,material,collision={},{},{},{} local signPart=nil -- A returned BasePart can arrive before its Workspace parent replicates. -- Do not immediately issue CreatePart again in that situation: it can -- create duplicate geometry. Only retry explicit remote errors/false. local function makeConfirmedMapPart(spec,cf,index) local lastProblem='no response' for attempt=1,4 do if realmRegistry.cancelBuild or not gui.Parent then error('Map creation stopped; existing pieces remain tracked for removal.') end local remoteOK,result=pcall(function() return endpoint:InvokeServer('CreatePart',spec.partType or 'Normal',cf,workspace) end) if remoteOK and typeof(result)=='Instance' and result:IsA('BasePart') then local untilTime=os.clock()+1.5 while not result:IsDescendantOf(workspace) and os.clock()0 then local worked,response=pcall(function() return endpoint:InvokeServer('Remove',batch) end) if not worked or response==false then spawnCleanupNotice='F3X refused to remove some existing spawns.' break end task.wait(math.max(.10,config.f3xDelay)) end end for _,old in ipairs(candidates) do if old:IsDescendantOf(workspace) then remainingOldSpawns=remainingOldSpawns+1 else removedOldSpawns=removedOldSpawns+1 end end if remainingOldSpawns>0 then spawnCleanupNotice=spawnCleanupNotice~='' and spawnCleanupNotice or 'Some existing spawns remain (F3X permissions or replication).' else spawnCleanupNotice='Old spawn cleanup complete.' end else spawnCleanupNotice='Other game spawns kept (game owner permission required).' end end end) if ok then completedOperations=totalOperations reportBuild('Completed',true) end realmBusy=false local count=#liveRealmParts() local errorText=tostring(err) if not ok then errorText=errorText:match('(F3X CreatePart[^\n]*)') or errorText:match('(CreatePart[^\n]*)') or errorText:match('(Map creation[^\n]*)') or errorText end lastRealmResult={ok=ok and count==#specs, detail=ok and (count..'/'..#specs..' parts created; sign '..signConfirmed..'/2; castle spawn '.. ((theme=='LimboRealm' and validRealmPart(spawnPart)) and 'YES' or 'N/A')..'; removed '..removedOldSpawns.. ' old spawns; remaining '..remainingOldSpawns..'. '..spawnCleanupNotice) or errorText} if not gui.Parent then return end if lastRealmResult.ok then if options.fun then -- Positional checkpoint markers from the completed blueprint. -- Gameplay timing, hazards and reset affect this player only. local mini={id=theme,name=labelMode,base=base, checkpoints={},hazards={},start=nil,finish=nil} for _,partSpec in ipairs(specs) do if partSpec.funRole then local marker={ cf=base*CFrame.new(partSpec.offset)*(partSpec.rotation or CFrame.new()), size=partSpec.size,id=partSpec.funId or 0, } if partSpec.funRole=='checkpoint' then mini.checkpoints[#mini.checkpoints+1]=marker elseif partSpec.funRole=='hazard' then mini.hazards[#mini.hazards+1]=marker elseif partSpec.funRole=='start' then mini.start=marker elseif partSpec.funRole=='finish' then mini.finish=marker end end end table.sort(mini.checkpoints,function(a,b) return a.id=2, {replace=true,quality=selectedMapQuality,label=selected.label,isolate=skyMapMode,fun=selected.fun, autoTeleport=(selected.theme=='ColossalKingdom'),onProgress=function(message) mapState.Text=message end}) if not began then mapState.Text='F3X status: build was not started; check the GUI message.' return end mapBusy=true task.spawn(function() while gui.Parent and realmBusy do task.wait(.3) end mapBusy=false if not gui.Parent then return end mapState.Text='F3X status: '..tostring(lastRealmResult.detail):sub(1,100) end) end local function removeBuiltMap() if mapBusy or busy or realmBusy then return say('Wait for the active operation to finish.') end if #liveRealmParts()==0 then return say('No tracked Pixel GUI map. The original game map is not managed by this script.') end mapBusy=true mapState.Text='F3X status: removing the current GUI-built map...' removeRealm() task.spawn(function() while gui.Parent and realmBusy do task.wait(.3) end mapBusy=false if gui.Parent then mapState.Text='F3X status: '..#liveRealmParts()..' GUI-built parts remain.' end end) end textButton(mapPage,'STOP BUILD',620,42,169,31,function() if not realmBusy then return say('No active realm build to stop.') end realmRegistry.cancelBuild=true mapState.Text='F3X status: stopping the build after its current request...' say('Stopping at the next F3X operation. Partial builds remain tracked for removal.') end) textButton(mapPage,'CHECK BTOOLS',620,79,169,31,function() local tool,endpoint,problem=detectBuildTool() mapState.Text=endpoint and ('F3X status: '..tool.Name..' ready') or ('F3X status: '..tostring(problem):sub(1,110)) say(endpoint and ('F3X ready: '..tool.Name) or problem,endpoint~=nil) end) textButton(mapPage,'BUILD / SWITCH MAP',16,367,376,36,beginMapBuild) textButton(mapPage,'REMOVE PIXEL GUI MAP',412,367,378,36,removeBuiltMap) local hideWorldButton hideWorldButton=textButton(mapPage,'HIDE ORIGINAL MAP (LOCAL)',16,405,376,28,function() if realmBusy or mapBusy then return say('Finish the map operation first.') end if #liveRealmParts()==0 then return say('Build your Pixel GUI realm first; the original map stays visible.') end originalView.autoHide=true local count,problem=hideOriginalWorld() if problem then return say(problem) end hideWorldButton.Text='HIDE ORIGINAL MAP (LOCAL)' say('Hidden '..count..' original world objects locally. Other players are unaffected.',true) end) textButton(mapPage,'RESTORE ORIGINAL MAP',412,405,378,28,function() if realmBusy or mapBusy then return say('Finish the map operation first.') end originalView.autoHide=false local restored=restoreOriginalWorld() say('Restored '..restored..' original world objects. Auto-hide disabled until HIDE is used.',true) end) -- BULK MAP CLEANUP (ORDINARY F3X/BTOOLS PERMISSIONS) -- No game-owner verification: same F3X operations as manual building tools. -- The game's server must still authorize every requested Remove/SyncMove. -- Selecting a Model or previewing current-map scenery are separate workflows. -- No custom remotes, permission bypasses, or automatic removal on scan. local ownerMove = realmRegistry.ownerMapMove if type(ownerMove)~='table' or type(ownerMove.records)~='table' then ownerMove={records={},active=false,cancel=false,modelName=''} realmRegistry.ownerMapMove=ownerMove end local ownerPicked=nil local ownerPrepared=nil local ownerConfirmUntil=0 local ownerPickConnection=nil local ownerCleanupBusy=false local ownerStatus=label(mapPage, 'BTOOLS MAP CLEANUP / F3X PERMISSIONS APPLY', 16,454,775,31,15,GOLD) local ownerDetail=label(mapPage, 'Move or delete a model below, or preview the current map for bulk removal.', 16,486,772,43,13,WHITE) local function ownerMapModelName(model) return model and (model.Name..' ('..model.ClassName..')') or 'none' end local function ownerModelAllowed(model) if not model or not model:IsDescendantOf(workspace) then return false,'Selected map is no longer in Workspace.' end if not (model:IsA('Model') or model:IsA('Folder')) or model.Parent~=workspace then return false,'Select a top-level Model or Folder directly under Workspace.' end if model:FindFirstChildWhichIsA('Humanoid',true) then return false,'Character/NPC models cannot be selected.' end for _,part in ipairs(liveRealmParts()) do if part:IsDescendantOf(model) then return false,'Your Pixel GUI map parts are protected from this action.' end end if f3xSkyPart and f3xSkyPart:IsDescendantOf(model) then return false,'Your sky dome is protected from this action.' end for _,record in ipairs(wingRegistry.records) do if record.part and record.part:IsDescendantOf(model) then return false,'Pixel GUI wings are protected from this action.' end end return true end local function collectOwnerParts(model) local allowed,reason=ownerModelAllowed(model) if not allowed then return nil,reason end local result={} local skipped=0 -- The cap prevents accidental multi-thousand-part modifications from one click. for _,item in ipairs(model:GetDescendants()) do if item:IsA('BasePart') then if item:IsA('SpawnLocation') or not item.Anchored then skipped=skipped+1 else result[#result+1]={part=item,original=item.CFrame} if #result>1200 then return nil,'Over 1,200 anchored parts. Split the map into smaller Models first.' end end end end if #result==0 then return nil,'No eligible anchored parts found in that model.' end return result,skipped end local function ownerProgress(message,good) ownerDetail.Text=message say(message,good) end local function ownerPickModel() if ownerCleanupBusy or realmBusy or mapBusy then return ownerProgress('Finish the current F3X job before picking a map.',false) end if ownerMove.active then return ownerProgress('Restore the previously moved model before selecting another.',false) end -- A locally hidden map is unpickable. Restore it visually before selection. if originalView.active then restoreOriginalWorld() end originalView.autoHide=false ownerPrepared=nil;ownerConfirmUntil=0;ownerPicked=nil if ownerPickConnection then ownerPickConnection:Disconnect();ownerPickConnection=nil end ownerStatus.Text='SELECT MAP MODEL: click a part belonging to its top-level Model' ownerProgress('Click one part of the ORIGINAL map in the 3D world (not a GUI button).',true) -- Delay connection so clicking this button cannot also count as picking the map. task.delay(0.2,function() if not gui.Parent then return end ownerPickConnection=mouse.Button1Down:Connect(function() local hit=mouse.Target if not hit then return end local root=hit while root and root.Parent and root.Parent~=workspace do root=root.Parent end if not root or root.Parent~=workspace then return end if not (root:IsA('Model') or root:IsA('Folder')) then ownerProgress('That part is loose in Workspace; group it into a Model in Studio.',false) return end local ok,err=ownerModelAllowed(root) if not ok then return ownerProgress(err,false) end ownerPicked=root ownerPrepared=nil ownerConfirmUntil=0 ownerStatus.Text='SELECTED: '..ownerMapModelName(root) ownerProgress('Selected '..root.Name..'. Press PREVIEW before moving anything.',true) if ownerPickConnection then ownerPickConnection:Disconnect();ownerPickConnection=nil end end) end) end local function previewOwnerMap() if ownerCleanupBusy or realmBusy or mapBusy then return ownerProgress('F3X is busy.',false) end if not ownerPicked then return ownerProgress('Click SELECT MAP MODEL first.',false) end local parts,skipped=collectOwnerParts(ownerPicked) if not parts then ownerPrepared=nil;return ownerProgress(skipped,false) end ownerPrepared=parts;ownerConfirmUntil=0 ownerStatus.Text='PREVIEW: '..#parts..' anchored parts in '..ownerPicked.Name ownerProgress('Preview: '..#parts..' movable parts; '..skipped..' spawns/unanchored skipped. No edits yet.',true) end local function moveOwnerMap() if ownerCleanupBusy or realmBusy or mapBusy then return ownerProgress('Finish current F3X job.',false) end if ownerMove.active then return ownerProgress('A map is already moved. Restore it first.',false) end if not ownerPrepared or not ownerPicked then return ownerProgress('Select and PREVIEW a map first.',false) end local allowed,why=ownerModelAllowed(ownerPicked) if not allowed then return ownerProgress(why,false) end if os.clock()>ownerConfirmUntil then ownerConfirmUntil=os.clock()+12 return ownerProgress('CONFIRM: click MOVE ORIGINAL MAP again within 12 seconds to relocate '..#ownerPrepared..' parts SERVER-WIDE.',false) end ownerConfirmUntil=0 local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip F3X/BTools.',false) end -- Must match the preview. Edits/moving objects after preview invalidate it. local again,reason=collectOwnerParts(ownerPicked) if not again then return ownerProgress(reason,false) end if #again~=#ownerPrepared then ownerPrepared=nil return ownerProgress('Map changed since preview; preview again.',false) end for i,r in ipairs(again) do local old=ownerPrepared[i] if r.part~=old.part or (r.original.Position-old.original.Position).Magnitude>0.2 then ownerPrepared=nil return ownerProgress('Map moved or changed since preview; preview again.',false) end end ownerCleanupBusy=true;mapBusy=true;realmBusy=true;ownerMove.cancel=false ownerMove.modelName=ownerPicked.Name ownerMove.records={};ownerMove.active=true local pending=again ownerStatus.Text='F3X SERVER RELOCATION IN PROGRESS' task.spawn(function() local ok,err=pcall(function() -- Move the specifically selected original map 8,000 studs above play. -- Keep original CFrames so this action can be reversed in-session. local lift=Vector3.new(0,8000,0) for start=1,#pending,8 do if ownerMove.cancel then error('Cancelled by user') end local packet={} local records={} for i=start,math.min(#pending,start+7) do local r=pending[i] if r.part:IsDescendantOf(workspace) then records[#records+1]=r packet[#packet+1]={Part=r.part,CFrame=r.original+lift} end end if #packet>0 then local reply=endpoint:InvokeServer('SyncMove',packet) if reply==false then error('F3X refused a SyncMove batch') end for _,r in ipairs(records) do ownerMove.records[#ownerMove.records+1]=r end end if start%64==1 or start+7>=#pending then ownerStatus.Text='SERVER MAP MOVE: '..math.min(start+7,#pending)..' / '..#pending end task.wait(math.max(0.12,config.f3xDelay)) end end) ownerCleanupBusy=false;mapBusy=false;realmBusy=false;ownerPrepared=nil if #ownerMove.records==0 then ownerMove.active=false end if not gui.Parent then return end if ok then ownerProgress('F3X move requests sent for '..#ownerMove.records..' parts. Original map is stored above play; RESTORE to undo.',true) else ownerProgress('Relocation stopped: '..tostring(err):sub(1,100)..'. RESTORE MOVED MAP to undo completed batches.',false) end end) end local function restoreOwnerMap() if ownerCleanupBusy or mapBusy or realmBusy then return ownerProgress('Finish the current operation first.',false) end if not ownerMove.active or #ownerMove.records==0 then return ownerProgress('No server map relocation recorded for this session.',false) end local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip F3X/BTools.',false) end ownerCleanupBusy=true;mapBusy=true;realmBusy=true ownerStatus.Text='RESTORING ORIGINAL MAP VIA F3X' task.spawn(function() local kept={} local records=ownerMove.records local failure=nil for start=1,#records,8 do local packet={} local batch={} for i=start,math.min(start+7,#records) do local r=records[i] if r.part:IsDescendantOf(workspace) then packet[#packet+1]={Part=r.part,CFrame=r.original} batch[#batch+1]=r end end local ok,reply=pcall(function() if #packet==0 then return true end return endpoint:InvokeServer('SyncMove',packet) end) if not ok or reply==false then for _,r in ipairs(batch) do kept[#kept+1]=r end failure=tostring(reply) end ownerStatus.Text='RESTORE: '..math.min(start+7,#records)..' / '..#records task.wait(math.max(0.12,config.f3xDelay)) end ownerMove.records=kept ownerMove.active=#kept>0 ownerCleanupBusy=false;mapBusy=false;realmBusy=false if not gui.Parent then return end ownerStatus.Text=ownerMove.active and 'PARTIAL RESTORE • retry' or 'ORIGINAL MAP RESTORED' if ownerMove.active then ownerProgress('Some parts could not be restored: '..#kept..' left. '..tostring(failure):sub(1,70),false) else ownerProgress('Original map restore requests completed. Only parts recorded by this tool were affected.',true) end end) end -- SELECTED MODEL REMOVAL: regular F3X Remove requests after preview. -- F3X server permissions determine whether an edit is permitted. local ownerDeleteConfirmUntil=0 local ownerDeleteBusy=false local function deleteSelectedOwnerMap() if ownerCleanupBusy or ownerDeleteBusy or realmBusy or mapBusy then return ownerProgress('Another map operation is running.',false) end if ownerMove.active then return ownerProgress('RESTORE MOVED MAP before deleting a different map.',false) end if not ownerPicked or not ownerPrepared then return ownerProgress('First SELECT MAP MODEL and PREVIEW MODEL.',false) end local parts,reason=collectOwnerParts(ownerPicked) if not parts then ownerPrepared=nil;return ownerProgress(reason,false) end if #parts~=#ownerPrepared then ownerPrepared=nil return ownerProgress('Original map changed since preview. Preview it again.',false) end for i,record in ipairs(parts) do local previous=ownerPrepared[i] if record.part~=previous.part or (record.original.Position-previous.original.Position).Magnitude>0.2 then ownerPrepared=nil return ownerProgress('Map selection changed since preview. Preview again.',false) end end if os.clock()>ownerDeleteConfirmUntil then ownerDeleteConfirmUntil=os.clock()+12 ownerStatus.Text='WARNING: PERMANENT F3X DELETION' return ownerProgress('PERMANENT: click DELETE SELECTED MAP again within 12s to delete ' ..#parts..' parts from '..ownerPicked.Name..'. Back up in Studio first!',false) end ownerDeleteConfirmUntil=0 local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip authorized F3X/BTools.',false) end ownerMove.cancel=false ownerCleanupBusy=true;ownerDeleteBusy=true;realmBusy=true;mapBusy=true local prepared=parts local expected=#prepared local modelName=ownerPicked.Name ownerStatus.Text='DELETING SELECTED MAP MODEL' task.spawn(function() local requested=0 local problemText=nil for first=1,#prepared,8 do if ownerMove.cancel then problemText='Cancelled';break end -- Recheck ownership for every batch, and never use loose Workspace parts. local batch={} for i=first,math.min(first+7,#prepared) do local part=prepared[i].part if part and part:IsDescendantOf(ownerPicked) and part:IsA('BasePart') and not part:IsA('SpawnLocation') and part.Anchored then batch[#batch+1]=part end end if #batch>0 then local ok,reply=pcall(function() return endpoint:InvokeServer('Remove',batch) end) if not ok or reply==false then problemText='F3X refused Remove: '..tostring(reply) break end requested=requested+#batch end ownerStatus.Text='DELETE REQUESTS: '..math.min(first+7,expected)..'/'..expected task.wait(math.max(0.12,config.f3xDelay)) end task.wait(0.5) local remaining=0 for _,record in ipairs(prepared) do if record.part and record.part:IsDescendantOf(workspace) then remaining=remaining+1 end end ownerCleanupBusy=false;ownerDeleteBusy=false;realmBusy=false;mapBusy=false ownerPrepared=nil ownerMove.cancel=false if not gui.Parent then return end if problemText then ownerStatus.Text='PARTIAL DELETE / F3X ERROR' ownerProgress('Delete stopped: '..problemText:sub(1,90)..'. ' ..remaining..'/'..expected..' selected parts still exist. Deletion cannot be undone.',false) elseif remaining>0 then ownerStatus.Text='PARTIAL DELETE / VERIFY PERMISSIONS' ownerProgress('Sent '..requested..' F3X Remove requests; '..remaining.. ' parts still visible. Server permissions or replication may have blocked deletion.',false) else ownerStatus.Text='SELECTED ORIGINAL MAP REMOVED' ownerProgress('Removed '..expected..' selected original map parts in '..modelName.. '. Pixel GUI map and unrelated Workspace objects were not selected.',true) end end) end textButton(mapPage,'SELECT MAP MODEL',16,535,375,35,ownerPickModel) textButton(mapPage,'PREVIEW MODEL',412,535,378,35,previewOwnerMap) textButton(mapPage,'MOVE SELECTED MAP',16,580,375,35,moveOwnerMap) textButton(mapPage,'RESTORE MOVED MAP',412,580,378,35,restoreOwnerMap) textButton(mapPage,'STOP MAP OPERATION',16,627,375,30,function() if not ownerCleanupBusy then return ownerProgress('No server cleanup in progress.',false) end ownerMove.cancel=true ownerProgress('Stop requested. Earlier DELETE batches cannot be undone.',true) end) textButton(mapPage,'DELETE SELECTED MODEL',412,627,378,30,deleteSelectedOwnerMap) label(mapPage, 'These tools use your existing F3X/BTools permissions. No owner verification or new remotes.' ..' DELETE is permanent wherever the server allows it. MOVE / RESTORE is reversible.' ..' For loose map parts and mixed models, use the CURRENT MAP preview below.', 16,665,773,72,12,QUIET) -- CURRENT MAP: scan visible Workspace geometry, including loose anchored parts. -- This is a convenience wrapper around the SAME F3X Remove operation as manual -- BTools. Scanning is local; deletion can replicate when the server authorizes it. do local scanned=nil local confirmBefore=0 local scanBusy=false local MAX_SCAN_PARTS=12000 label(mapPage,'CURRENT MAP / BULK REMOVE',16,754,760,30,18,GOLD) local scanStatus=label(mapPage, 'No ownership check. Scan anchored map geometry, review the count, then delete via F3X.', 16,790,774,48,13,WHITE) local function protectedPartSet() local protected={} for _,part in ipairs(liveRealmParts()) do protected[part]=true end if f3xSkyPart then protected[f3xSkyPart]=true end for _,r in ipairs(wingRegistry.records) do if r.part then protected[r.part]=true end end for _,r in ipairs(titanRegistry.records) do if r.part then protected[r.part]=true end end local staff=env.__PixelGUI_StaffCataclysm if type(staff)=='table' and staff.sessionKey==mapSessionKey and type(staff.parts)=='table' then for _,r in ipairs(staff.parts) do if typeof(r)=='Instance' and r:IsA('BasePart') then protected[r]=true elseif type(r)=='table' and r.part then protected[r.part]=true end end end return protected end local function eligible(part,protect) if not part:IsA('BasePart') or not part.Anchored or part:IsA('SpawnLocation') or not part:IsDescendantOf(workspace) or protect[part] then return false end local parent=part.Parent while parent and parent~=workspace do if parent:IsA('Tool') or parent:IsA('Accessory') then return false end if parent:IsA('Model') and parent:FindFirstChildOfClass('Humanoid') then return false end parent=parent.Parent end return true end local function preview() if ownerCleanupBusy or realmBusy or mapBusy or scanBusy then return ownerProgress('Finish the current map operation first.',false) end -- Locally hidden parts remain in Workspace; unhide so the preview matches what the player sees. if originalView.active then restoreOriginalWorld() end originalView.autoHide=false scanned=nil;confirmBefore=0 scanBusy=true local protect=protectedPartSet() local results={} local countSkipped=0 for index,part in ipairs(workspace:GetDescendants()) do if part:IsA('BasePart') then if eligible(part,protect) then results[#results+1]={part=part,original=part.CFrame} if #results>MAX_SCAN_PARTS then scanBusy=false scanStatus.Text='Preview stopped: more than '..MAX_SCAN_PARTS..' map parts. Select a smaller model.' return ownerProgress(scanStatus.Text,false) end else countSkipped=countSkipped+1 end end if index%550==0 then task.wait() end end scanBusy=false if #results==0 then scanStatus.Text='No eligible anchored map parts found.' return ownerProgress(scanStatus.Text,false) end scanned=results scanStatus.Text='PREVIEW: '..#results..' anchored parts can be requested for removal. ' ..countSkipped..' excluded (characters, GUI builds, spawns, or unanchored).' ownerProgress('Preview complete. '..#results..' map parts selected. Nothing has been deleted.',true) end local function removeScanned() if ownerCleanupBusy or realmBusy or mapBusy or scanBusy then return ownerProgress('A map operation is already running.',false) end if not scanned or #scanned==0 then return ownerProgress('Click PREVIEW CURRENT MAP first.',false) end if os.clock()>confirmBefore then confirmBefore=os.clock()+12 scanStatus.Text='CONFIRM: Delete '..#scanned..' previewed map parts? ' ..'Click DELETE PREVIEWED MAP again within 12 seconds. This cannot be undone.' return ownerProgress('Permanent deletion: confirm by clicking DELETE PREVIEWED MAP again.',false) end confirmBefore=0 local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip F3X/BTools first.',false) end local items=scanned scanned=nil local protect=protectedPartSet() ownerMove.cancel=false ownerCleanupBusy=true;mapBusy=true;realmBusy=true;scanBusy=true scanStatus.Text='Sending F3X Remove requests...' task.spawn(function() local requested=0 local reason=nil local invalid=0 for first=1,#items,8 do if ownerMove.cancel or not gui.Parent then reason='Stopped by user';break end local batch={} for index=first,math.min(#items,first+7) do local r=items[index] -- Never add parts created after preview or moved to another location. if eligible(r.part,protect) and (r.part.Position-r.original.Position).Magnitude<0.2 then batch[#batch+1]=r.part else invalid=invalid+1 end end if #batch>0 then local ok,reply=pcall(function() return endpoint:InvokeServer('Remove',batch) end) if not ok or reply==false then reason='F3X refused request: '..tostring(reply) break end requested=requested+#batch end if first%64==1 or first+7>=#items then scanStatus.Text='F3X DELETE: '..math.min(first+7,#items)..'/'..#items end task.wait(math.max(0.12,config.f3xDelay)) end task.wait(0.4) local remain=0 for _,r in ipairs(items) do if r.part:IsDescendantOf(workspace) then remain=remain+1 end end ownerCleanupBusy=false;mapBusy=false;realmBusy=false;scanBusy=false ownerMove.cancel=false if not gui.Parent then return end if reason or remain>0 then scanStatus.Text='Finished / partial: '..remain..' of '..#items..' parts still exist.' ownerProgress((reason or 'Server permissions or streaming blocked some changes.') ..' Requested '..requested..', skipped '..invalid..', remaining '..remain..'.',false) else scanStatus.Text='Current map removed: '..#items..' previewed parts.' ownerProgress('F3X removed '..#items..' previewed map parts. Other Pixel GUI parts were excluded.',true) end end) end textButton(mapPage,'PREVIEW CURRENT MAP',16,851,376,38,preview) textButton(mapPage,'DELETE PREVIEWED MAP',412,851,378,38,removeScanned) label(mapPage, 'Only anchored BaseParts are included. Players, NPCs, SpawnLocations, unanchored objects, and tracked Pixel GUI parts ' ..'are excluded. Some custom event props may appear in the preview. F3X permissions still apply; ' ..'authorized removal may affect everyone in the server. Back up first.', 16,904,773,95,12,QUIET) end -- UNANCHOR ALL: ordinary authorized F3X SyncAnchor calls. This only changes -- BasePart.Anchored; terrain voxels cannot be unanchored using F3X. -- Preview, double-confirmation, batch cancellation and last-batch reanchor. do local MAX_UNANCHOR_PARTS=12000 local unanchorPreview=nil local unanchorConfirm=0 local unanchorScanBusy=false local unanchorLast={} local unanchorBusy=false local includePixelBuilds=true label(mapPage,'PHYSICS / UNANCHOR ALL',16,1020,770,30,18,GOLD) local unanchorStatus=label(mapPage, 'Preview anchored scenery, then use F3X to release the parts. Server permissions apply.', 16,1055,774,42,13,WHITE) -- Skip objects that are not ordinary map geometry, rather than relying on -- an ownership check. The F3X server is the actual permission authority. local function unanchorEligible(part,protected) if not part or not part:IsA('BasePart') or not part.Anchored or part:IsA('SpawnLocation') or not part:IsDescendantOf(workspace) or (protected and protected[part]) then return false end local parent=part.Parent while parent and parent~=workspace do if parent:IsA('Tool') or parent:IsA('Accessory') then return false end if parent:IsA('Model') and parent:FindFirstChildOfClass('Humanoid') then return false end parent=parent.Parent end return true end local function excludedPixelParts() local protected={} if includePixelBuilds then return protected end for _,p in ipairs(liveRealmParts()) do protected[p]=true end if f3xSkyPart then protected[f3xSkyPart]=true end for _,r in ipairs(wingRegistry.records) do if r.part then protected[r.part]=true end end for _,r in ipairs(titanRegistry.records) do if r.part then protected[r.part]=true end end local staff=env.__PixelGUI_StaffCataclysm if type(staff)=='table' and staff.sessionKey==mapSessionKey and type(staff.parts)=='table' then for _,r in ipairs(staff.parts) do if typeof(r)=='Instance' and r:IsA('BasePart') then protected[r]=true elseif type(r)=='table' and r.part then protected[r.part]=true end end end return protected end local includeButton includeButton=textButton(mapPage,'INCLUDE PIXEL BUILDS: YES',16,1109,774,31,function() if unanchorBusy or unanchorScanBusy or ownerCleanupBusy then return end includePixelBuilds=not includePixelBuilds unanchorPreview=nil unanchorConfirm=0 includeButton.Text=includePixelBuilds and 'INCLUDE PIXEL BUILDS: YES' or 'INCLUDE PIXEL BUILDS: NO' unanchorStatus.Text='Selection changed. Press PREVIEW UNANCHOR again.' end) local function previewUnanchor() if unanchorBusy or unanchorScanBusy or ownerCleanupBusy or mapBusy or realmBusy then return ownerProgress('Finish the current F3X operation first.',false) end unanchorPreview=nil;unanchorConfirm=0;unanchorScanBusy=true local list={} local protected=excludedPixelParts() local truncated=false for i,part in ipairs(workspace:GetDescendants()) do if unanchorEligible(part,protected) then if #list>=MAX_UNANCHOR_PARTS then truncated=true;break end list[#list+1]=part end if i%500==0 then task.wait() end end unanchorScanBusy=false if truncated then unanchorStatus.Text='More than '..MAX_UNANCHOR_PARTS..' parts. Narrow the map before unanchoring.' return ownerProgress(unanchorStatus.Text,false) end if #list==0 then unanchorStatus.Text='No eligible anchored BaseParts in the current map.' return ownerProgress(unanchorStatus.Text,false) end unanchorPreview=list unanchorStatus.Text='PREVIEW: '..#list..' anchored parts. Pixel GUI builds ' ..(includePixelBuilds and 'included.' or 'excluded.') ownerProgress('Preview ready: '..#list..' parts. No changes made.',true) end local function performUnanchor() if unanchorBusy or unanchorScanBusy or ownerCleanupBusy or mapBusy or realmBusy then return ownerProgress('Another map operation is running.',false) end if not unanchorPreview or #unanchorPreview==0 then return ownerProgress('Press PREVIEW UNANCHOR first.',false) end if os.clock()>unanchorConfirm then unanchorConfirm=os.clock()+12 unanchorStatus.Text='CONFIRM: UNANCHOR '..#unanchorPreview ..' parts? Click UNANCHOR ALL again within 12 seconds.' return ownerProgress('Gravity may collapse the map for other players. Confirm with a second click.',false) end unanchorConfirm=0 local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip authorized F3X/BTools.',false) end local list=unanchorPreview unanchorPreview=nil local protected=excludedPixelParts() unanchorLast={} ownerMove.cancel=false unanchorBusy=true;ownerCleanupBusy=true;mapBusy=true;realmBusy=true unanchorStatus.Text='Unanchoring with F3X...' task.spawn(function() local requested,skipped=0,0 local errorMessage=nil for first=1,#list,12 do if ownerMove.cancel or not gui.Parent then errorMessage='Stopped by user';break end local batch={} for i=first,math.min(first+11,#list) do local part=list[i] if unanchorEligible(part,protected) then batch[#batch+1]={Part=part,Anchored=false} else skipped=skipped+1 end end if #batch>0 then local ok,reply=pcall(function() return endpoint:InvokeServer('SyncAnchor',batch) end) if not ok or reply==false then errorMessage='F3X SyncAnchor rejected: '..tostring(reply) break end requested=requested+#batch for _,change in ipairs(batch) do unanchorLast[#unanchorLast+1]=change.Part end end if first%60==1 or first+11>=#list then unanchorStatus.Text='UNANCHOR: '..math.min(first+11,#list)..'/'..#list end task.wait(math.max(0.12,config.f3xDelay)) end task.wait(0.5) local stillAnchored=0 for _,part in ipairs(unanchorLast) do if part:IsDescendantOf(workspace) and part.Anchored then stillAnchored=stillAnchored+1 end end unanchorBusy=false;ownerCleanupBusy=false;mapBusy=false;realmBusy=false ownerMove.cancel=false if not gui.Parent then return end unanchorStatus.Text='Requested '..requested..' / '..#list ..'; still anchored '..stillAnchored..'; skipped '..skipped if errorMessage then ownerProgress(errorMessage..'. Requested '..requested..' before stopping.',false) elseif stillAnchored>0 then ownerProgress('Unanchor requests sent, but '..stillAnchored ..' parts remain anchored. Check F3X permissions/game scripts.',false) else ownerProgress('Sent F3X unanchor requests for '..requested ..' parts. Gravity/replication depends on the game server.',true) end end) end local function reanchorLast() if unanchorBusy or unanchorScanBusy or ownerCleanupBusy or mapBusy or realmBusy then return ownerProgress('Finish the current map operation first.',false) end if #unanchorLast==0 then return ownerProgress('Nothing recorded from UNANCHOR ALL to reanchor.',false) end local _,endpoint,problem=detectBuildTool() if not endpoint then return ownerProgress(problem or 'Equip F3X/BTools first.',false) end ownerMove.cancel=false unanchorBusy=true;ownerCleanupBusy=true;mapBusy=true;realmBusy=true local list=unanchorLast unanchorLast={} task.spawn(function() local requested=0 local errorMessage=nil local remaining={} for first=1,#list,12 do if ownerMove.cancel or not gui.Parent then errorMessage='Stopped by user' end local batch={} for i=first,math.min(first+11,#list) do local part=list[i] if part and part:IsDescendantOf(workspace) then if errorMessage then remaining[#remaining+1]=part else batch[#batch+1]={Part=part,Anchored=true} end end end if #batch>0 then local ok,reply=pcall(function() return endpoint:InvokeServer('SyncAnchor',batch) end) if not ok or reply==false then errorMessage='F3X refused reanchor: '..tostring(reply) for _,change in ipairs(batch) do remaining[#remaining+1]=change.Part end else requested=requested+#batch end end unanchorStatus.Text='REANCHOR: '..math.min(first+11,#list)..'/'..#list task.wait(math.max(0.12,config.f3xDelay)) end unanchorLast=remaining unanchorBusy=false;ownerCleanupBusy=false;mapBusy=false;realmBusy=false ownerMove.cancel=false if not gui.Parent then return end unanchorStatus.Text='REANCHOR requested for '..requested..' parts.' ownerProgress((errorMessage and errorMessage..'. ' or '') ..'Reanchor freezes parts at their CURRENT positions, not their old positions. ' ..#remaining..' parts remain on the reanchor list.',not errorMessage) end) end textButton(mapPage,'PREVIEW UNANCHOR',16,1155,376,38,previewUnanchor) textButton(mapPage,'UNANCHOR ALL (F3X)',412,1155,378,38,performUnanchor) textButton(mapPage,'STOP UNANCHOR',16,1205,376,35,function() if not unanchorBusy then return ownerProgress('No unanchor/reanchor operation running.',false) end ownerMove.cancel=true ownerProgress('Stop requested: completed F3X batches may already have changed physics.',true) end) textButton(mapPage,'REANCHOR LAST',412,1205,378,35,reanchorLast) label(mapPage, 'UNANCHOR ALL includes regular map BaseParts and (optionally) Pixel GUI creations. ' ..'It skips characters, tools, accessories and SpawnLocations; Roblox Terrain voxels are not BaseParts. ' ..'Only server-authorized F3X SyncAnchor edits can replicate. REANCHOR does not restore fallen parts.', 16,1253,773,110,12,QUIET) end do -- FUN MAP CHALLENGE: client-side timer/checkpoints for F3X-generated maps. textButton(mapPage,'BACK TO MAP LIST',620,1376,170,27,function() mapPage.CanvasPosition=Vector2.new(0,0) end) label(mapPage,'FUN MAP CHALLENGE',16,1408,760,29,18,GOLD) label(mapPage, 'Build a fun map above, then START CHALLENGE. Checkpoints and hazards are local to you; ' ..'the course geometry is built with your existing F3X permissions.', 16,1442,772,47,13,WHITE) local runStatus=label(mapPage,'No playable map built yet. Choose one of the five FUN MAPS.', 16,1490,773,42,13,AMBER) local sessionText=label(mapPage,'TIME --:--.-- CHECKPOINT -- BEST --:--.--', 16,1538,770,32,15,GOLD) local scoreboard=ui('Frame',{ Name='FunMapsTimer',Size=UDim2.fromOffset(238,70), Position=UDim2.new(1,-250,0,14),Visible=false, BackgroundColor3=DARK,BorderSizePixel=0, },gui) ui('UICorner',{CornerRadius=UDim.new(0,7)},scoreboard) stroke(scoreboard,GOLD) local scoreboardTitle=label(scoreboard,'FUN MAP CHALLENGE',10,5,218,22,13,GOLD) local scoreboardTime=label(scoreboard,'TIME 00:00.00',10,28,215,18,15,WHITE) local scoreboardStage=label(scoreboard,'CP 0/0 | 0 resets',10,48,218,18,12,QUIET) local state={map=nil,active=false,completed=false,clock=0,stamp=0, next=1,resetAt=0,resets=0,checkpoint=nil,autoreset=true} local best=env.__PixelGUI_FunMapBests if type(best)~='table' then best={} env.__PixelGUI_FunMapBests=best end local function formatTime(seconds) seconds=math.max(0,tonumber(seconds) or 0) return string.format('%02d:%05.2f',math.floor(seconds/60),seconds%60) end local function ensureMap() local fun=realmRegistry.funGame if fun~=state.map then state.map=fun state.active=false;state.completed=false;state.next=1 state.clock=0;state.stamp=0;state.resets=0 state.checkpoint=nil;state.resetAt=0 if fun then runStatus.Text='Loaded: '..fun.name..'. Start the timed challenge when ready.' else runStatus.Text='Build one of the five fun maps first.' end end return fun end local function teleportTo(marker) local char=player.Character local hrp=char and char:FindFirstChild('HumanoidRootPart') if not hrp or not marker then return false,'Character or checkpoint not ready' end local ok,err=pcall(function() char:PivotTo(marker.cf*CFrame.new(0,6,0)) end) return ok,err end local function isAtMarker(marker,foot,margin) if not marker then return false end local point=marker.cf:PointToObjectSpace(foot) margin=margin or 3 return math.abs(point.X)<=marker.size.X/2+margin and math.abs(point.Z)<=marker.size.Z/2+margin and math.abs(point.Y-marker.size.Y/2)<=5.5 end local function resetToCheckpoint(reason) if not state.autoreset and reason then runStatus.Text=reason..' Press RESET CHECKPOINT to recover.' return end local now=os.clock() if now-state.resetAt<1.2 then return end state.resetAt=now local target=state.checkpoint or (state.map and state.map.start) local ok,err=teleportTo(target) if ok then state.resets=state.resets+1 runStatus.Text=(reason or 'Restarted')..' Back to checkpoint ' ..math.max(0,state.next-1)..'.' else runStatus.Text='Reset failed: '..tostring(err):sub(1,92)..'. Try respawning.' end end local function startChallenge() local fun=ensureMap() if not fun or not fun.start or not fun.finish or #liveRealmParts()==0 then return say('Build a FUN MAP completely before starting its challenge.') end if realmBusy or mapBusy then return say('Wait for the map build to finish.') end local ok,err=teleportTo(fun.start) if not ok then return say('Cannot move to start: '..tostring(err):sub(1,90)) end state.active=true;state.completed=false;state.stamp=os.clock() state.clock=0;state.next=1;state.resets=0 state.checkpoint=fun.start;state.resetAt=os.clock() runStatus.Text='GO! Follow checkpoints in order, then reach the green finish pad.' scoreboard.Visible=true say('Challenge started: '..fun.name..'. Local timer running.',true) end local startButton=textButton(mapPage,'START / RESTART CHALLENGE',16,1582,376,39,startChallenge) textButton(mapPage,'RESET TO CHECKPOINT',412,1582,378,39,function() local fun=ensureMap() if not fun then return say('Build a FUN MAP first.') end if not state.active then return say('Start the challenge before resetting a checkpoint.') end state.resetAt=0 resetToCheckpoint('Manual reset.') end) local autoButton autoButton=textButton(mapPage,'AUTO RETRY: ON',16,1630,376,34,function() state.autoreset=not state.autoreset autoButton.Text='AUTO RETRY: '..(state.autoreset and 'ON' or 'OFF') runStatus.Text=state.autoreset and 'Auto retry enabled: falling/hazards return to checkpoint.' or 'Auto retry disabled: manually reset if you fall.' end) textButton(mapPage,'STOP CHALLENGE',412,1630,378,34,function() state.active=false;state.completed=false runStatus.Text='Challenge stopped. Press START to try again.' scoreboard.Visible=false say('Fun map timer stopped.',true) end) label(mapPage, 'How it works: yellow platforms mark checkpoints, green marks the finish, and red ' ..'hazards reset only your character. A completed run requires the checkpoints in order. ' ..'The on-foot race is one lap; the Dropper ends at the landing pad. ' ..'Personal bests last for this game session. No custom server remotes or scripts.', 16,1678,774,107,12,QUIET) label(mapPage, 'Note: the server may restrict teleport/reset. Other players can use the physical ' ..'F3X course, but they do not automatically share your local timer or hazard rules.', 16,1800,774,53,12,AMBER) local tickAccumulator=0 local function tickChallenge(dt) local fun=ensureMap() tickAccumulator=tickAccumulator+(dt or 0) if tickAccumulator<.10 then return end tickAccumulator=0 if not fun then scoreboard.Visible=false sessionText.Text='TIME --:--.-- CHECKPOINT -- BEST --:--.--' return end local cpCount=#fun.checkpoints local b=best[fun.id] local seconds=state.active and os.clock()-state.stamp or state.clock if state.active then local char=player.Character local hrp=char and char:FindFirstChild('HumanoidRootPart') if hrp then local foot=hrp.Position-Vector3.new(0,2.8,0) local nextCheckpoint=fun.checkpoints[state.next] if nextCheckpoint and isAtMarker(nextCheckpoint,foot,4) then state.checkpoint=nextCheckpoint state.next=state.next+1 runStatus.Text=('Checkpoint %d/%d! Keep going.'):format(state.next-1,cpCount) end local bad=false for _,hazard in ipairs(fun.hazards) do if isAtMarker(hazard,foot,1) then bad=true;break end end if bad then resetToCheckpoint('Hazard hit!') elseif fun.id~='VoidDropper' then local last=state.checkpoint or fun.start local diff=last and (last.cf.Position.Y-hrp.Position.Y) or 0 local limit=(fun.id=='TowerTrials' and 17) or 28 if diff>limit then resetToCheckpoint('Fell off the course!') end elseif hrp.Position.YcpCount and isAtMarker(fun.finish,foot,4) then state.clock=os.clock()-state.stamp state.active=false;state.completed=true if not b or state.clock20 then return false end return value:match('^[%w_]+$')~=nil end local function canonicalUsername(raw) local v=tostring(raw or ''):gsub('^@','') if validUsername(v) then return v:lower() end return nil end local function formatLoopkickNames() local names={} for _,name in pairs(loopkickNames) do names[#names+1]=name end table.sort(names,function(a,b) return a:lower()=5 and saved.barrierRadius<=250 then barrierRadius=math.floor(saved.barrierRadius*10+0.5)/10 end if type(saved.barrierShowSphere)=='boolean' then barrierShowSphere=saved.barrierShowSphere end if type(saved.names)=='table' then for _,name in ipairs(saved.names) do local canon=canonicalUsername(name) if canon and numLoopkickNames()<50 and canon~=player.Name:lower() then loopkickNames[canon]=tostring(name):gsub('^@','') end end end end end end local function saveKickPreferences() if type(writefile)~='function' then return false,'No local file access; saved for this session only.' end local names={} for _,name in pairs(loopkickNames) do names[#names+1]=name end table.sort(names) local ok,err=pcall(function() writefile(kickStore,kickJSON:JSONEncode({version=1,names=names, barrierReason=barrierReason,loopkickReason=loopkickReason, barrierRadius=barrierRadius,barrierShowSphere=barrierShowSphere})) end) return ok,ok and 'Saved for future sessions.' or tostring(err) end local function submitKickFor(username,reason) if not validUsername(username) or username:lower()==player.Name:lower() then return false,'Invalid or self username' end if not gui.Parent then return false,'GUI was closed' end local cmd=';kick '..username..' '..cleanReason(reason,'Kick') local called,ok,detail=pcall(submitHDAdminCommand,cmd) if not called then return false,tostring(ok) end return ok,ok and ('Submitted: '..cmd) or tostring(detail) end -- BARRIER KICK: configurable proximity + reason. label(scriptsPage,'BARRIER KICK • PROXIMITY',16,446,650,30,19,GOLD) label(scriptsPage,'Detect nearby players and send one kick request when they enter your radius.',16,475,776,28,13,AMBER) label(scriptsPage,'RADIUS (5–250 STUDS) • Preview uses this value',16,506,420,22,14,WHITE) local barrierRadiusBox=textbox(scriptsPage,'Radius in studs',16,533,190,35) barrierRadiusBox.Text=tostring(barrierRadius) local barrierStatus=label(scriptsPage,'Barrier Kick OFF • 0 requests',275,657,520,40,13,QUIET) local function setBarrierStatus(msg,good) if barrierStatus.Parent then barrierStatus.Text=msg barrierStatus.TextColor3=good==nil and QUIET or (good and GREEN or AMBER) end end label(scriptsPage,'KICK REASON (SHOWN TO PLAYER)',16,585,430,22,14,WHITE) local barrierReasonBox=textbox(scriptsPage,'Reason for proximity kick',16,612,780,36) barrierReasonBox.Text=barrierReason -- Local visual guide ONLY: does not modify map parts, affect movement, or replicate. -- The visible sphere follows HumanoidRootPart through Adornee (no constant CFrame updates). local function updateBarrierSphere() if not barrierShowSphere or not gui.Parent then if barrierSphere then barrierSphere:Destroy(); barrierSphere=nil end return end local rootPart=player.Character and player.Character:FindFirstChild('HumanoidRootPart') if not (barrierSphere and barrierSphere.Parent) then barrierSphere=Instance.new('SphereHandleAdornment') barrierSphere.Name='RetroF3X_BarrierRadiusSphere' barrierSphere.AlwaysOnTop=false barrierSphere.Color3=GOLD barrierSphere.Transparency=0.84 barrierSphere.Parent=guiParent end barrierSphere.Radius=barrierRadius barrierSphere.Adornee=rootPart end local barrierPreviewToggle local function setPreviewButtonText() if barrierPreviewToggle then barrierPreviewToggle.Text=barrierShowSphere and 'HIDE RADIUS SPHERE' or 'SHOW RADIUS SPHERE' barrierPreviewToggle.BackgroundColor3=barrierShowSphere and Color3.fromRGB(98,77,32) or DARK end end local function tryUpdateBarrierRadius(showError) local radius=tonumber(barrierRadiusBox.Text) if not radius or radius~=radius or radius<5 or radius>250 then if showError then say('Radius preview: enter a value from 5 to 250 studs.') end return false end radius=math.floor(radius*10+0.5)/10 if radius ~= barrierRadius then barrierRadius=radius -- Treat range edits as a new entry boundary when barrier is already active. table.clear(barrierInside) table.clear(barrierQueue) end updateBarrierSphere() return true end barrierPreviewToggle=textButton(scriptsPage,'SHOW RADIUS SPHERE',16,660,245,37,function() if not tryUpdateBarrierRadius(true) then return end barrierShowSphere=not barrierShowSphere setPreviewButtonText() updateBarrierSphere() saveKickPreferences() -- Optional: executor may not expose writefile. say(barrierShowSphere and ('Barrier preview ON, '..barrierRadius..' studs (local only).') or 'Barrier preview hidden.',true) end) barrierPreviewToggle.TextSize=12 -- Bind textbox edits to the live radius while both barrier and preview remain active. barrierRadiusBox.FocusLost:Connect(function() if tryUpdateBarrierRadius(true) then barrierRadiusBox.Text=tostring(barrierRadius) saveKickPreferences() end end) player.CharacterAdded:Connect(function() if not gui.Parent then return end task.defer(function() if gui.Parent then updateBarrierSphere() end end) end) -- Extra cleanup when the GUI is removed through a script reload or close button. gui.Destroying:Connect(function() if barrierSphere then barrierSphere:Destroy(); barrierSphere=nil end end) setPreviewButtonText() updateBarrierSphere() local function stopBarrier() barrierEnabled=false table.clear(barrierInside) table.clear(barrierQueue) barrierToggle.Text='ENABLE BARRIER KICK' barrierToggle.BackgroundColor3=DARK setBarrierStatus('Barrier Kick OFF • '..barrierSent..' requests') end barrierToggle=textButton(scriptsPage,'ENABLE BARRIER KICK',228,532,263,40,function() if barrierEnabled then return stopBarrier() end if not tryUpdateBarrierRadius(true) then return end barrierReason=cleanReason(barrierReasonBox.Text,'Barrier Kick') barrierReasonBox.Text=barrierReason barrierRadiusBox.Text=tostring(barrierRadius) barrierSent=0 table.clear(barrierInside) table.clear(barrierQueue) barrierEnabled=true barrierToggle.Text='DISABLE BARRIER KICK' barrierToggle.BackgroundColor3=Color3.fromRGB(100,63,24) setBarrierStatus('Barrier ON • '..barrierRadius..' studs • scanning nearby players',true) say('Barrier Kick enabled. Server must permit '..config.commandPrefix..'kick.',true) end) local barrierStop=textButton(scriptsPage,'STOP + CLEAR QUEUE',508,532,288,40,stopBarrier) barrierStop.TextSize=13 label(scriptsPage,'Reasons cannot contain semicolons/newlines. At least 2s between kick requests.',16,703,775,30,12,QUIET) task.spawn(function() while gui.Parent do task.wait(0.75) if barrierShowSphere then updateBarrierSphere() end if barrierEnabled then local myRoot=player.Character and player.Character:FindFirstChild('HumanoidRootPart') if myRoot and myRoot:IsA('BasePart') then local insideNow={} for _,other in ipairs(Players:GetPlayers()) do if other~=player then local theirRoot=other.Character and other.Character:FindFirstChild('HumanoidRootPart') if theirRoot and theirRoot:IsA('BasePart') then if (myRoot.Position-theirRoot.Position).Magnitude<=barrierRadius then insideNow[other.UserId]=true if not barrierInside[other.UserId] then barrierInside[other.UserId]=true if #barrierQueue<20 then table.insert(barrierQueue,other.UserId) end end end end end end for userId in pairs(barrierInside) do if not insideNow[userId] then barrierInside[userId]=nil end end if #barrierQueue>0 and not kickSharedBusy and not commandBusy and os.clock()-kickSharedLast>=math.max(KICK_GAP,config.commandDelay) then local userId=table.remove(barrierQueue,1) local other=Players:GetPlayerByUserId(userId) local theirRoot=other and other.Character and other.Character:FindFirstChild('HumanoidRootPart') if other and other~=player and theirRoot and theirRoot:IsA('BasePart') and (myRoot.Position-theirRoot.Position).Magnitude<=barrierRadius then kickSharedBusy=true kickSharedLast=os.clock() barrierReason=cleanReason(barrierReasonBox.Text,'Barrier Kick') local ok,detail=submitKickFor(other.Name,barrierReason) barrierSent=barrierSent+1 setBarrierStatus((ok and 'Sent: ' or 'Failed: ')..tostring(detail):sub(1,105).. ' • requests '..barrierSent,ok) kickSharedBusy=false end end else setBarrierStatus('Barrier ON — waiting for your character...',false) end end end end) -- LOOPKICK: saved username list. Only targets a joining username, not similarly named players. label(scriptsPage,'LOOPKICK • USERNAME LIST',16,746,660,30,19,GOLD) label(scriptsPage,'Put one username per line (commas also work), then SAVE LIST. Display names do not count.',16,776,785,31,13,AMBER) local loopkickEditor=textbox(scriptsPage,'ExamplePlayer\nAnotherPlayer',16,814,780,122) loopkickEditor.MultiLine=true loopkickEditor.TextYAlignment=Enum.TextYAlignment.Top loopkickEditor.TextXAlignment=Enum.TextXAlignment.Left loopkickEditor.TextWrapped=true loopkickEditor.Text=formatLoopkickNames() local loopkickListStatus=label(scriptsPage,'Saved usernames: '..numLoopkickNames()..' / 50',16,1077,780,30,13,QUIET) local loopkickStatus=label(scriptsPage,'Loopkick OFF • 0 requests',16,1136,775,65,14,QUIET) local function setLoopkickStatus(msg,good) if loopkickStatus.Parent then loopkickStatus.Text=msg loopkickStatus.TextColor3=good==nil and QUIET or (good and GREEN or AMBER) end end local function parseLoopkickList(raw) local added={} local ignored={} for token in tostring(raw or ''):gmatch('[^,%s]+') do local canon=canonicalUsername(token) if canon and canon~=player.Name:lower() then added[canon]=token:gsub('^@','') else ignored[#ignored+1]=token:sub(1,24) end end local count=0 for _ in pairs(added) do count=count+1 end if count>50 then return nil,'Maximum 50 usernames.' end if #ignored>0 then return nil,'Invalid username(s): '..table.concat(ignored,', '):sub(1,115) end return added end label(scriptsPage,'LOOPKICK REASON (SHOWN TO PLAYER)',16,1007,525,22,14,WHITE) local loopkickReasonBox=textbox(scriptsPage,'Reason for list kick',16,1033,780,36) loopkickReasonBox.Text=loopkickReason local function saveLoopkickForm() local updated,errorText=parseLoopkickList(loopkickEditor.Text) if not updated then return false,errorText end loopkickNames=updated barrierReason=cleanReason(barrierReasonBox.Text,'Barrier Kick') loopkickReason=cleanReason(loopkickReasonBox.Text,'Loopkick') barrierReasonBox.Text=barrierReason loopkickReasonBox.Text=loopkickReason loopkickEditor.Text=formatLoopkickNames() loopkickListStatus.Text='Saved usernames: '..numLoopkickNames()..' / 50' local saved,detail=saveKickPreferences() setLoopkickStatus('List and reasons updated. '..tostring(detail):sub(1,120),saved) return true,detail end local loopkickSave=textButton(scriptsPage,'SAVE LIST + REASONS',16,951,240,42,function() local ok,err=saveLoopkickForm() if not ok then setLoopkickStatus(err,false) end end) loopkickSave.TextSize=13 local function stopLoopkick() loopkickEnabled=false table.clear(loopkickQueue) table.clear(loopkickQueued) loopkickToggle.Text='ENABLE LOOPKICK' loopkickToggle.BackgroundColor3=DARK setLoopkickStatus('Loopkick OFF • '..loopkickSent..' requests sent') end loopkickToggle=textButton(scriptsPage,'ENABLE LOOPKICK',270,951,255,42,function() if loopkickEnabled then return stopLoopkick() end local ok,err=saveLoopkickForm() if not ok then return setLoopkickStatus(err,false) end if numLoopkickNames()==0 then return setLoopkickStatus('Add at least one username to the list.',false) end loopkickEnabled=true loopkickSent=0 loopkickToggle.Text='DISABLE LOOPKICK' loopkickToggle.BackgroundColor3=Color3.fromRGB(100,63,24) setLoopkickStatus('Loopkick ON • watching for listed usernames to join',true) end) local loopkickStop=textButton(scriptsPage,'STOP + CLEAR QUEUE',539,951,257,42,stopLoopkick) loopkickStop.TextSize=13 local function queueLoopkick(other) if not gui.Parent or not loopkickEnabled or not other or other==player then return end local key=other.Name:lower() if not loopkickNames[key] or loopkickQueued[other.UserId] then return end if #loopkickQueue>=50 then return setLoopkickStatus('Loopkick queue full (50).',false) end loopkickQueued[other.UserId]=true loopkickQueue[#loopkickQueue+1]={userId=other.UserId,username=other.Name} setLoopkickStatus('Detected '..other.Name..' joining • queued '..#loopkickQueue..' kick request(s)',true) end Players.PlayerAdded:Connect(function(joiningPlayer) if gui.Parent then queueLoopkick(joiningPlayer) end end) -- Optional manual pass for players already in this server; intentionally not automatic on enable. local loopkickNow=textButton(scriptsPage,'PROCESS LISTED PLAYERS ALREADY HERE',16,1209,384,35,function() if not loopkickEnabled then return setLoopkickStatus('Enable Loopkick first.',false) end for _,other in ipairs(Players:GetPlayers()) do queueLoopkick(other) end end) loopkickNow.TextSize=11 label(scriptsPage,'Only actual usernames are matched. List is stored locally if available.',415,1207,380,44,12,QUIET) task.spawn(function() while gui.Parent do task.wait(0.35) if loopkickEnabled and #loopkickQueue>0 and not kickSharedBusy and not commandBusy and os.clock()-kickSharedLast>=math.max(KICK_GAP,config.commandDelay) then local record=table.remove(loopkickQueue,1) loopkickQueued[record.userId]=nil local current=Players:GetPlayerByUserId(record.userId) -- If they've left, changed identities, or been removed from the list, discard the request. if current and current~=player and current.Name==record.username and loopkickNames[current.Name:lower()] then kickSharedBusy=true kickSharedLast=os.clock() loopkickReason=cleanReason(loopkickReasonBox.Text,'Loopkick') local ok,detail=submitKickFor(current.Name,loopkickReason) loopkickSent=loopkickSent+1 setLoopkickStatus((ok and 'Sent: ' or 'Failed: ')..tostring(detail):sub(1,105).. ' • requests '..loopkickSent,ok) kickSharedBusy=false end end end end) end)() -- kick controls isolated from the main register pool -- F3X CLONE ARMY v4: multiple platoons, grouped formations, up to 384 soldiers. -- Uses only the existing F3X SyncAPI, respecting the game's own permissions. -- 7 parts per soldier: larger armies take longer to spawn and move in batches. ;(function() local MAX_SOLDIERS=384 local MAX_PLATOONS=12 local MAX_PER_PLATOON=32 local armyPlatoons=1 local armyTroopsPerPlatoon=24 local armyPlatoonGap=24 local armyPlatoonPalette={ Color3.fromRGB(237,149,193),Color3.fromRGB(98,193,225), Color3.fromRGB(238,194,96),Color3.fromRGB(177,150,236), Color3.fromRGB(130,218,161),Color3.fromRGB(247,157,122), Color3.fromRGB(239,218,153),Color3.fromRGB(132,170,251), Color3.fromRGB(227,129,155),Color3.fromRGB(113,215,206), Color3.fromRGB(192,198,207),Color3.fromRGB(204,160,246), } local army={} local armyBusy=false local armyFollow=false local armyOrbit=false local armyStop=false local armyMode='grid' local orbitAngle=0 local moveSerial=0 local armySpeed=8 local collisionsOn=false local marchAnimation=true local collisionButton local animationButton local armyInfo=label(scriptsPage,'CLONE ARMY V4 • MULTI-PLATOON COMMAND',16,1267,765,29,19,GOLD) label(scriptsPage,'Up to 12 platoons and 384 soldiers. Large armies build and march more slowly.',16,1299,775,36,13,WHITE) label(scriptsPage,'SINGLE ARMY (1–384)',16,1338,186,21,13,GOLD) local armyCountBox=textbox(scriptsPage,'24',16,1363,170,34) armyCountBox.Text='24' label(scriptsPage,'MARCH DISTANCE (2–80)',202,1338,258,21,13,GOLD) local armyDistanceBox=textbox(scriptsPage,'15',202,1363,191,34) armyDistanceBox.Text='15' label(scriptsPage,'WALK SPEED (3–16)',408,1338,184,21,13,GOLD) local armySpeedBox=textbox(scriptsPage,'8',408,1363,140,34) armySpeedBox.Text='8' local armyState=label(scriptsPage,'Army: 0 | Idle',566,1353,236,52,13,GREEN) local followButton local orbitButton local function state(msg,ok) if not armyState.Parent then return end armyState.Text=tostring(msg) armyState.TextColor3=(ok==false) and AMBER or GREEN say('Clone Army: '..tostring(msg),ok~=false) end local function validModel(model) return typeof(model)=='Instance' and model:IsA('Model') and model:IsDescendantOf(workspace) end local function currentArmy() local valid={} for _,record in ipairs(army) do if validModel(record.model) then valid[#valid+1]=record end end army=valid return army end local function endpointForArmy() local tool,endpoint,problem=detectBuildTool() if not endpoint then return nil,problem or 'Equip F3X tools first.' end return endpoint end local function call(endpoint,action,...) local ok,result,a,b=pcall(function(...) return endpoint:InvokeServer(action,...) end,...) if not ok then error('F3X '..action..': '..tostring(result),2) end if result==false then error('F3X rejected '..action,2) end return result,a,b end local function getRoot() local char=player.Character local hrp=char and char:FindFirstChild('HumanoidRootPart') if not hrp then error('Character not ready') end return hrp end local function soldierParts(model) local parts={} for _,child in ipairs(model:GetDescendants()) do if child:IsA('BasePart') then parts[#parts+1]=child end end if #parts<6 then error('Soldier model is incomplete (check cloning).') end return parts end local function trackSoldier(model,base,platoon,slot) local record={model=model,root=base,parts=soldierParts(model),rel={},legs={},arms={},phase=0, platoon=platoon or 1,slot=slot or 1,visor=nil} for _,part in ipairs(record.parts) do local relative=base:ToObjectSpace(part.CFrame) record.rel[part]=relative -- Classify only the two legs and two arms for opposite-swing gait. local pos=relative.Position if pos.Y>5 and pos.Z<-.7 then record.visor=part end if pos.Y<2.4 and math.abs(pos.X)<1.4 then record.legs[part]=(pos.X<0 and 1 or -1) elseif pos.Y>=2.4 and pos.Y<4.9 and math.abs(pos.X)>1.4 then record.arms[part]=(pos.X<0 and -1 or 1) end end return record end local function getStreamingClone(streamId) if type(streamId)~='number' then return nil end local deadline=os.clock()+2.2 repeat for _,desc in ipairs(workspace:GetDescendants()) do if desc:IsA('Model') and desc:GetAttribute('BTStreamingCloneID')==streamId then return desc end end task.wait(.12) until os.clock()>deadline or not gui.Parent return nil end local function updateModeButtons() if followButton and followButton.Parent then followButton.Text=armyFollow and 'FOLLOW ME: ON' or 'FOLLOW ME: OFF' end if orbitButton and orbitButton.Parent then orbitButton.Text=armyOrbit and 'ORBIT ME: ON' or 'ORBIT ME: OFF' end end local function stopModes() armyFollow=false armyOrbit=false moveSerial=moveSerial+1 updateModeButtons() end local function configuredSpeed() local speed=tonumber(armySpeedBox.Text) if not speed or speed~=speed or speed<3 or speed>16 then return nil,'Walk speed must be between 3 and 16.' end return speed end -- Every platoon uses a compact block, separated by visible formation gaps. -- The same mapping drives initial spawn and later group maneuvers. local function platoonOffset(index,total,number,size,gap,mode) local pi=math.floor((index-1)/size) local slot=(index-1)%size local unitCols=math.min(8,math.max(1,math.ceil(math.sqrt(size)*1.5))) local unitRows=math.ceil(size/unitCols) local sx=5.4 local width=math.max(26,(unitCols-1)*sx+12) local depth=math.max(22,(unitRows-1)*sx+12) local platoonX,platoonZ=0,0 if mode=='platoon_column' then local platoonCols=math.min(number,2) platoonX=((pi%platoonCols)-(platoonCols-1)/2)*(width+gap) platoonZ=math.floor(pi/platoonCols)*(depth+gap) elseif mode=='platoon_wedge' then local row=0 local slotIndex=pi+1 while slotIndex>row*2+1 do slotIndex=slotIndex-(row*2+1) row=row+1 end local rowWidth=row*2+1 platoonX=(slotIndex-(rowWidth+1)/2)*(width+gap) platoonZ=row*(depth+gap) elseif mode=='battlefront' then platoonX=(pi-(number-1)/2)*(math.max(width,(size-1)*sx)+gap) else local platoonCols=math.min(4,number) platoonX=((pi%platoonCols)-(platoonCols-1)/2)*(width+gap) platoonZ=math.floor(pi/platoonCols)*(depth+gap) end local col,row if mode=='battlefront' then col=slot row=0 return Vector3.new(platoonX+(col-(size-1)/2)*sx,-3,16+platoonZ) end col=slot%unitCols row=math.floor(slot/unitCols) return Vector3.new(platoonX+(col-(unitCols-1)/2)*sx,-3, 16+platoonZ+row*sx) end local function recolorPlatoons(endpoint) if armyPlatoons<=1 then return end local changes={} for _,record in ipairs(currentArmy()) do if record.visor and record.visor.Parent then changes[#changes+1]={Part=record.visor, Color=armyPlatoonPalette[((record.platoon-1)%#armyPlatoonPalette)+1], UnionColoring=false} end end for first=1,#changes,48 do if armyStop or not gui.Parent then return end local chunk={} for j=first,math.min(first+47,#changes) do chunk[#chunk+1]=changes[j] end call(endpoint,'SyncColor',chunk) if first+48<=#changes then task.wait(math.max(config.f3xDelay,.15)) end end end local function spawn(count,platoons,troopsPer,gap) if armyBusy or realmBusy or busy then return false,'Another F3X build is running.' end if #currentArmy()>0 then return false,'Remove the existing army first.' end if type(count)~='number' or count<1 or count>MAX_SOLDIERS or count%1~=0 then return false,'Soldier count must be 1 to '..MAX_SOLDIERS..'.' end platoons=platoons or 1 troopsPer=troopsPer or count gap=gap or armyPlatoonGap if type(platoons)~='number' or platoons%1~=0 or platoons<1 or platoons>MAX_PLATOONS then return false,'Platoons must be 1 to '..MAX_PLATOONS..'.' end if platoons>1 and (troopsPer%1~=0 or troopsPer<4 or troopsPer>MAX_PER_PLATOON or count~=platoons*troopsPer) then return false,'Use 4–32 soldiers per platoon (maximum 384 total).' end if type(gap)~='number' or gap~=gap or gap<10 or gap>120 then return false,'Platoon spacing must be 10–120 studs.' end local endpoint,problem=endpointForArmy() if not endpoint then return false,problem end stopModes();armyStop=false;armyBusy=true armyPlatoons=platoons armyTroopsPerPlatoon=troopsPer armyPlatoonGap=gap local made={} local buildStarted=os.clock() local ok,err=pcall(function() local characterRoot=getRoot().CFrame local columns=math.min(12,math.max(1,math.ceil(math.sqrt(count)*1.3))) local function initialPosition(i) if armyPlatoons>1 then return characterRoot*CFrame.new(platoonOffset(i,count,platoons,troopsPer,gap,'parade')) end local row=math.floor((i-1)/columns) local col=(i-1)%columns return characterRoot*CFrame.new((col-(columns-1)/2)*5,-3,12+row*5) end local base=initialPosition(1) local specs={ {Vector3.new(0,5.4,0),Vector3.new(2,2,2),Color3.fromRGB(245,221,148)}, {Vector3.new(0,3.5,0),Vector3.new(2.5,2.6,1.4),Color3.fromRGB(45,45,56)}, {Vector3.new(-1.85,3.5,0),Vector3.new(1,2.6,1.3),Color3.fromRGB(241,201,120)}, {Vector3.new(1.85,3.5,0),Vector3.new(1,2.6,1.3),Color3.fromRGB(241,201,120)}, {Vector3.new(-.72,1.1,0),Vector3.new(1.05,2.1,1.3),Color3.fromRGB(185,128,169)}, {Vector3.new(.72,1.1,0),Vector3.new(1.05,2.1,1.3),Color3.fromRGB(185,128,169)}, {Vector3.new(0,5.45,-1.03),Vector3.new(1.5,.45,.16),Color3.fromRGB(250,193,228)}, } local parts,resize,colours,collisions={},{},{},{} state('Building the seven-piece soldier template...') for _,spec in ipairs(specs) do if armyStop or not gui.Parent then error('Build cancelled') end local cf=base*CFrame.new(spec[1]) local part=call(endpoint,'CreatePart','Normal',cf,workspace) if not validRealmPart(part) then error('F3X CreatePart did not return a replicated part.') end made[#made+1]=part;parts[#parts+1]=part resize[#resize+1]={Part=part,CFrame=cf,Size=spec[2]} colours[#colours+1]={Part=part,Color=spec[3],UnionColoring=false} collisions[#collisions+1]={Part=part,CanCollide=false} task.wait(math.max(config.f3xDelay,.15)) end call(endpoint,'SyncResize',resize);task.wait(config.f3xDelay) call(endpoint,'SyncColor',colours);task.wait(config.f3xDelay) call(endpoint,'SyncCollision',collisions);task.wait(config.f3xDelay) local model=call(endpoint,'CreateGroup','Model',workspace,parts) if not validModel(model) then error('F3X CreateGroup failed.') end made[#made+1]=model call(endpoint,'SetName',{model},'Pixel_GUI_Army_Soldier') army[#army+1]=trackSoldier(model,base,1,1) for i=2,count do if armyStop or not gui.Parent then error('Build cancelled') end if i==2 or i%8==0 or i==count then local eta=math.ceil((os.clock()-buildStarted)/math.max(1,i-1)*(count-i)) state(('Platoon %d/%d • %d/%d • ~%ds left') :format(math.floor((i-1)/troopsPer)+1,platoons,i,count,eta)) end local clones,streamId=call(endpoint,'Clone',{model},workspace) local clone=(type(clones)=='table' and clones[1]) or getStreamingClone(streamId) if not validModel(clone) then error('F3X Clone failed / streaming clone was not found.') end made[#made+1]=clone local record=trackSoldier(clone,base,math.floor((i-1)/troopsPer)+1,(i-1)%troopsPer+1) -- Place each clone immediately to avoid stacking 128 soldiers in -- a single spot before a slow mass formation operation. local target=initialPosition(i) local moves={} for _,part in ipairs(record.parts) do moves[#moves+1]={Part=part,CFrame=target*record.rel[part]} end call(endpoint,'SyncMove',moves) record.root=target army[#army+1]=record task.wait(math.max(config.f3xDelay,.17)) if i%32==0 then task.wait(.8) end end if armyPlatoons>1 then state('Marking '..armyPlatoons..' platoons with distinct visor colors...') recolorPlatoons(endpoint) end end) if not ok then armyBusy=false local existing=#currentArmy() if existing>0 then return false,'PARTIAL ARMY: '..existing..'/'..count..' soldiers created; ' ..tostring(err):sub(1,130)..'. Use REMOVE ARMY to clean up.' end pcall(function() local objects={} for _,obj in ipairs(made) do if typeof(obj)=='Instance' and obj:IsDescendantOf(workspace) and obj.Parent==workspace then objects[#objects+1]=obj end end if #objects>0 then call(endpoint,'Remove',objects) end end) return false,tostring(err):sub(1,200) end armyBusy=false if count>96 then -- Large 7-part armies already require numerous F3X moves. -- Keep the gait optional to prioritize formation updates. marchAnimation=false if animationButton and animationButton.Parent then animationButton.Text='MARCH GAIT: OFF' end end return true,'Created '..#army..' soldiers across '..armyPlatoons..' platoon(s).' end local function targetFor(record,index,count,mode,hrp,angle) local spacing=4.35 local origin=hrp.CFrame if armyPlatoons>1 and (mode=='parade' or mode=='platoon_column' or mode=='platoon_wedge' or mode=='battlefront' or mode=='follow') then local formation=(mode=='follow' and 'parade') or mode return origin*CFrame.new(platoonOffset(index,count,armyPlatoons, armyTroopsPerPlatoon,armyPlatoonGap,formation)) end if mode=='line' then return origin*CFrame.new((index-(count+1)/2)*spacing,-3,10) elseif mode=='v' then local lane=math.ceil((index-1)/2) local side=(index%2==0 and 1 or -1) if index==1 then return origin*CFrame.new(0,-3,10) end return origin*CFrame.new(side*lane*spacing,-3,10+lane*3.8) elseif mode=='circle' or mode=='orbit' then local radius=math.max(11,count*1.1) local theta=2*math.pi*(index-1)/count+(angle or 0) local offset=Vector3.new(math.cos(theta)*radius,-3,math.sin(theta)*radius) local pos=hrp.Position+offset local look=Vector3.new(hrp.Position.X,pos.Y,hrp.Position.Z) return CFrame.lookAt(pos,look) elseif mode=='shield' then local cols=math.min(count,12) local row=math.floor((index-1)/cols) local col=(index-1)%cols return origin*CFrame.new((col-(cols-1)/2)*3.8,-3,10+row*4.0) elseif mode=='ranks' then local cols=math.min(count,12) local row=math.floor((index-1)/cols) local col=(index-1)%cols return origin*CFrame.new((col-(cols-1)/2)*5.0,-3,13+row*5.4) elseif mode=='column' then local cols=math.min(count,4) local row=math.floor((index-1)/cols) local col=(index-1)%cols return origin*CFrame.new((col-(cols-1)/2)*4.5,-3,12+row*4.7) elseif mode=='wedge' then -- Rows grow 1,3,5... while maintaining a centered military wedge. local row=0 local slot=index while slot>(row*2+1) do slot=slot-(row*2+1) row=row+1 end local width=row*2+1 return origin*CFrame.new((slot-(width+1)/2)*5,-3,12+row*5) elseif mode=='grid' or mode=='follow' then local cols=math.min(12,math.max(1,math.ceil(math.sqrt(count)*1.3))) local row=math.floor((index-1)/cols) local col=(index-1)%cols return origin*CFrame.new((col-(cols-1)/2)*spacing,-3,12+row*spacing) end error('Unknown army formation: '..tostring(mode)) end -- Animated stepped movement: marching soldiers swing arms opposite legs. -- F3X moves each anchored part individually. For large formations, bounded -- batches prevent one huge remote call, but cadence must scale with size. local function advance(endpoint,targets,seconds,motion,legsOnly) local soldiers=currentArmy() if #soldiers==0 then return true,0 end local changes={} local positions={} local farthest=0 for i,record in ipairs(soldiers) do local target=targets[i] if target then local root=record.root local delta=target.Position-root.Position local distance=delta.Magnitude farthest=math.max(farthest,distance) local maxStep=math.max(.3,armySpeed*seconds) local position=(distance>maxStep) and (root.Position+delta.Unit*maxStep) or target.Position local desired local levelDelta=Vector3.new(target.Position.X-position.X,0,target.Position.Z-position.Z) if distance>.65 and levelDelta.Magnitude>.05 then desired=CFrame.lookAt(position,position+levelDelta) else desired=CFrame.new(position)*target.Rotation end local rotate=CFrame.new(position)*(root.Rotation:Lerp(desired.Rotation,math.min(1,seconds*3))) positions[i]=rotate local moving=motion and (distance>.4 or legsOnly) local swinging=moving and marchAnimation local gait=math.sin(record.phase) local bob=swinging and .09*math.abs(gait) or 0 local base=rotate*CFrame.new(0,bob,0) for _,part in ipairs(record.parts) do if part.Parent and (not legsOnly or record.legs[part] or record.arms[part]) then local relative=record.rel[part] local leg=record.legs[part] local arm=record.arms[part] if swinging and leg then relative=relative*CFrame.Angles(gait*leg*.57,0,0) elseif swinging and arm then relative=relative*CFrame.Angles(gait*arm*.38,0,0) end changes[#changes+1]={Part=part,CFrame=base*relative} end end -- Opposite phase on neighboring soldiers gives a regimented look. if swinging then record.phase=record.phase+math.min(seconds,.65)*5.5 end end end local maxBatch=72 for from=1,#changes,maxBatch do if armyStop or not gui.Parent then break end local subset={} for k=from,math.min(from+maxBatch-1,#changes) do subset[#subset+1]=changes[k] end call(endpoint,'SyncMove',subset) if from+maxBatch<=#changes then task.wait(math.max(config.f3xDelay,.12)) end end for i,record in ipairs(soldiers) do if positions[i] then record.root=positions[i] end end return farthest<1, farthest end local function movementTime() local count=#currentArmy() -- Up to 2688 parts for 384 soldiers. These are coarse F3X steps, -- never presented as 60-FPS shared animation. return (count<=12 and .25) or (count<=24 and .40) or (count<=48 and .65) or (count<=80 and 1.0) or (count<=128 and 1.5) or (count<=192 and 2.6) or (count<=288 and 4.2) or 5.8 end local function moveFormation(mode) if armyBusy or realmBusy or busy then return false,'F3X is busy.' end if #currentArmy()==0 then return false,'Spawn the army first.' end local speed,problem=configuredSpeed() if not speed then return false,problem end local endpoint,err=endpointForArmy() if not endpoint then return false,err end stopModes();armyStop=false;armyBusy=true;armySpeed=speed;armyMode=mode local ok,detail=pcall(function() local started=os.clock() while not armyStop and gui.Parent do local hrp=getRoot() local targets={} for i,record in ipairs(currentArmy()) do targets[i]=targetFor(record,i,#army,mode,hrp) end local dt=movementTime() local tickStarted=os.clock() local arrived=advance(endpoint,targets,dt,true) if arrived then break end if os.clock()-started>180 then error('Formation timed out. Try fewer soldiers or another formation.') end -- Do not add an entire extra idle frame after slow F3X batches. task.wait(math.max(.05,dt-(os.clock()-tickStarted))) end end) armyBusy=false if not ok then return false,tostring(detail):sub(1,180) end return true,armyStop and 'Formation halted.' or ('Army formed '..mode..' ('..#army..' soldiers).') end local function march(distance) if armyBusy or realmBusy or busy then return false,'F3X is busy.' end local speed,problem=configuredSpeed() if not speed then return false,problem end local d=tonumber(distance) if not d or d~=d or d<2 or d>80 then return false,'March distance must be 2–80 studs.' end if #currentArmy()==0 then return false,'Spawn the army first.' end local endpoint,err=endpointForArmy() if not endpoint then return false,err end stopModes();armyStop=false;armyBusy=true;armySpeed=speed local ok,detail=pcall(function() local forward=getRoot().CFrame.LookVector local targets={} for i,record in ipairs(currentArmy()) do targets[i]=record.root+(forward*d) end local started=os.clock() while gui.Parent and not armyStop do local dt=movementTime() local tickStarted=os.clock() local arrived=advance(endpoint,targets,dt,true) if arrived then break end if os.clock()-started>180 then error('March timed out. Reduce distance or soldier count.') end task.wait(math.max(.05,dt-(os.clock()-tickStarted))) end end) armyBusy=false if not ok then return false,tostring(detail):sub(1,180) end return true,armyStop and 'March halted.' or ('Marched '..d..' studs with walking steps.') end local function setMode(kind) if #currentArmy()==0 then return false,'Spawn the army first.' end local speed,problem=configuredSpeed() if not speed then return false,problem end if armyBusy then return false,'Finish or HALT the previous formation first.' end local endpoint,err=endpointForArmy() if not endpoint then return false,err end armySpeed=speed;armyStop=false local enabled=(kind=='follow' and not armyFollow) or (kind=='orbit' and not armyOrbit) stopModes() if kind=='follow' then armyFollow=enabled end if kind=='orbit' then armyOrbit=enabled;orbitAngle=0 end updateModeButtons() return true, enabled and (kind=='follow' and 'Smooth follow ON' or 'Orbit ON') or 'Automatic movement stopped.' end local function halt() stopModes() armyStop=true return true,'Halt requested; any in-flight BTools move may finish first.' end local function removeArmy() if armyBusy then return false,'HALT and let the current move finish first.' end halt() local soldiers=currentArmy() if #soldiers==0 then return false,'No army to remove.' end armyStop=false local endpoint,problem=endpointForArmy() if not endpoint then return false,problem end local models={} for _,record in ipairs(soldiers) do models[#models+1]=record.model end armyBusy=true local removed=0 local ok,err=pcall(function() for first=1,#models,16 do if armyStop and removed>0 then break end local batch={} for i=first,math.min(first+15,#models) do batch[#batch+1]=models[i] end call(endpoint,'Remove',batch) removed=removed+#batch if first+16<=#models then task.wait(math.max(config.f3xDelay,.18)) end end end) armyBusy=false currentArmy() if not ok then return false,'Partial army removal ('..removed..'/'..#models..'): '..tostring(err):sub(1,130) end if #army==0 then armyPlatoons=1 collisionsOn=false if collisionButton and collisionButton.Parent then collisionButton.Text='COLLISIONS: OFF' end end return true,'Removed '..removed..' soldiers; '..#army..' remain.' end local function setCollisions() if armyBusy or realmBusy or busy then return false,'Finish the current F3X operation first.' end local soldiers=currentArmy() if #soldiers==0 then return false,'Spawn the army before changing collisions.' end local endpoint,problem=endpointForArmy() if not endpoint then return false,problem end local enable=not collisionsOn armyStop=false armyBusy=true local ok,err=pcall(function() local changes={} for _,record in ipairs(soldiers) do for _,part in ipairs(record.parts) do if part.Parent then local p=record.rel[part].Position -- Only legs and torso collide; arms, visor and head stay -- non-colliding so moving ranks do not snag nearby players. local body=(p.Y<4.9 and math.abs(p.X)<1.4) changes[#changes+1]={Part=part,CanCollide=enable and body or false} end end end for first=1,#changes,64 do if armyStop or not gui.Parent then error('Collisions update cancelled') end local chunk={} for k=first,math.min(first+63,#changes) do chunk[#chunk+1]=changes[k] end call(endpoint,'SyncCollision',chunk) if first+64<=#changes then task.wait(math.max(config.f3xDelay,.15)) end end end) armyBusy=false if not ok then return false,'Collision update failed: '..tostring(err):sub(1,125) end collisionsOn=enable if collisionButton and collisionButton.Parent then collisionButton.Text='COLLISIONS: '..(collisionsOn and 'ON' or 'OFF') end return true,'Soldier body collisions '..(enable and 'enabled' or 'disabled')..'.' end local function toggleGait() marchAnimation=not marchAnimation if animationButton and animationButton.Parent then animationButton.Text='MARCH GAIT: '..(marchAnimation and 'ON' or 'OFF') end return true,'March animation '..(marchAnimation and 'enabled' or 'disabled')..'.' end local function marchInPlace() if armyBusy or realmBusy or busy then return false,'Wait until current operation finishes.' end if #currentArmy()==0 then return false,'Spawn the army first.' end local endpoint,problem=endpointForArmy() if not endpoint then return false,problem end stopModes();armyStop=false;armyBusy=true local wasEnabled=marchAnimation marchAnimation=true local ok,err=pcall(function() local started=os.clock() while gui.Parent and not armyStop and os.clock()-started<10 do local targets={} for i,record in ipairs(currentArmy()) do targets[i]=record.root end advance(endpoint,targets,movementTime(),true,true) task.wait(movementTime()) end -- Return arms and legs to their neutral pose. for _,record in ipairs(currentArmy()) do record.phase=0 end if not armyStop then local targets={} for i,record in ipairs(currentArmy()) do targets[i]=record.root end local old=marchAnimation marchAnimation=false advance(endpoint,targets,.1,false,true) marchAnimation=old end end) marchAnimation=wasEnabled armyBusy=false if not ok then return false,'March animation failed: '..tostring(err):sub(1,150) end return true,'March-in-place session finished.' end armyActions.spawn=function(count) local ok,msg=spawn(count) if not ok then return false,msg end armyMode='ranks' collisionsOn=false if collisionButton and collisionButton.Parent then collisionButton.Text='COLLISIONS: OFF' end return true,'Spawned '..#army..' soldiers in military ranks.' end armyActions.spawnPlatoons=function(platoons,perPlatoon,gap) local p=tonumber(platoons) local each=tonumber(perPlatoon) local distance=tonumber(gap) or 24 if not p or p%1~=0 or p<2 or p>MAX_PLATOONS then return false,'Set platoons between 2 and '..MAX_PLATOONS..'.' end if not each or each%1~=0 or each<4 or each>MAX_PER_PLATOON then return false,'Soldiers per platoon must be 4–32.' end local ok,msg=spawn(p*each,p,each,distance) if not ok then return false,msg end armyMode='parade' collisionsOn=false if collisionButton and collisionButton.Parent then collisionButton.Text='COLLISIONS: OFF' end return true,'Deployed '..p..' platoons x '..each..' soldiers = '..#army..' troops.' end armyActions.formation=moveFormation armyActions.march=march armyActions.remove=removeArmy armyActions.follow=function() return setMode('follow') end armyActions.orbit=function() return setMode('orbit') end armyActions.halt=halt local function launch(action,...) local args={...} task.spawn(function() local success,msg=action(unpack(args)) if gui.Parent then state(msg,success) end end) end textButton(scriptsPage,'SPAWN SINGLE ARMY',16,1414,376,42,function() launch(armyActions.spawn,tonumber(armyCountBox.Text)) end) textButton(scriptsPage,'CHECK BTOOLS',408,1414,388,42,function() local tool,ep,problem=detectBuildTool() state(ep and ('Ready: '..tool.Name..' F3X SyncAPI') or problem,ep~=nil) end) textButton(scriptsPage,'FORM LINE',16,1469,250,39,function() launch(moveFormation,'line') end) textButton(scriptsPage,'FORM V',282,1469,246,39,function() launch(moveFormation,'v') end) textButton(scriptsPage,'FORM CIRCLE',544,1469,252,39,function() launch(moveFormation,'circle') end) textButton(scriptsPage,'FORM GRID',16,1521,250,39,function() launch(moveFormation,'grid') end) textButton(scriptsPage,'SHIELD WALL',282,1521,246,39,function() launch(moveFormation,'shield') end) textButton(scriptsPage,'RALLY TO ME',544,1521,252,39,function() launch(moveFormation,armyMode) end) textButton(scriptsPage,'MILITARY RANKS',16,1573,250,39,function() launch(moveFormation,'ranks') end) textButton(scriptsPage,'MARCH COLUMN',282,1573,246,39,function() launch(moveFormation,'column') end) textButton(scriptsPage,'WEDGE FORMATION',544,1573,252,39,function() launch(moveFormation,'wedge') end) textButton(scriptsPage,'MARCH FORWARD',16,1625,250,40,function() launch(march,tonumber(armyDistanceBox.Text)) end) followButton=textButton(scriptsPage,'FOLLOW ME: OFF',282,1625,246,40,function() launch(armyActions.follow) end) orbitButton=textButton(scriptsPage,'ORBIT ME: OFF',544,1625,252,40,function() launch(armyActions.orbit) end) textButton(scriptsPage,'HALT / GUARD HERE',16,1677,379,40,function() launch(halt) end) textButton(scriptsPage,'REMOVE ARMY',411,1677,385,40,function() launch(removeArmy) end) collisionButton=textButton(scriptsPage,'COLLISIONS: OFF',16,1729,379,40,function() launch(setCollisions) end) animationButton=textButton(scriptsPage,'MARCH GAIT: ON',411,1729,385,40,function() launch(toggleGait) end) textButton(scriptsPage,'MARCH IN PLACE (10 SEC)',16,1781,780,40,function() launch(marchInPlace) end) label(scriptsPage,'7-part F3X gait is best with 6–24 troops. 100+ troops require heavy network batching; disable gait for big parade maneuvers.',16,1835,780,59,13,AMBER) textButton(scriptsPage,'HD ADMIN: '..config.commandPrefix..'clone me (separate)',16,1910,380,40,function() sendScriptShortcut('HD Avatar Clone',{';clone me'}) end) label(scriptsPage,'Soldiers: pearl / rose / gold / charcoal. Removal affects only this army.',410,1910,384,49,12,QUIET) label(scriptsPage,'TIP: Use Multi-Platoon Command below for organized deployments. F3X can reject large builds.',16,1963,777,42,13,QUIET) -- MULTI-PLATOON COMMAND (same F3X API; no custom remotes). label(scriptsPage,'MULTI-PLATOON COMMAND',16,2022,760,31,19,GOLD) label(scriptsPage,'Each platoon spawns as a separated squad with its own colored visor. Up to 12 x 32 = 384.',16,2054,777,39,13,WHITE) label(scriptsPage,'PLATOONS (2–12)',16,2100,235,21,13,GOLD) local platoonCountBox=textbox(scriptsPage,'4',16,2124,220,36) platoonCountBox.Text='4' label(scriptsPage,'SOLDIERS / PLATOON (4–32)',254,2100,295,21,13,GOLD) local platoonSizeBox=textbox(scriptsPage,'24',254,2124,280,36) platoonSizeBox.Text='24' label(scriptsPage,'GAP (10–120)',550,2100,240,21,13,GOLD) local platoonGapBox=textbox(scriptsPage,'24',550,2124,246,36) platoonGapBox.Text='24' local totalPreview=label(scriptsPage,'PREVIEW: 4 platoons x 24 = 96 soldiers (672 F3X parts)',16,2168,776,31,13,GREEN) local function previewPlatoons() local p=tonumber(platoonCountBox.Text) local each=tonumber(platoonSizeBox.Text) local gap=tonumber(platoonGapBox.Text) if not p or p%1~=0 or p<2 or p>12 or not each or each%1~=0 or each<4 or each>32 or not gap or gap<10 or gap>120 then totalPreview.Text='Invalid setup: 2–12 platoons, 4–32 each, gap 10–120.' totalPreview.TextColor3=AMBER return nil end local total=p*each totalPreview.Text=('PREVIEW: %d platoons x %d = %d soldiers (%d F3X parts)') :format(p,each,total,total*7) totalPreview.TextColor3=GREEN return p,each,gap end platoonCountBox.FocusLost:Connect(previewPlatoons) platoonSizeBox.FocusLost:Connect(previewPlatoons) platoonGapBox.FocusLost:Connect(previewPlatoons) local function deployPreset(p,each) platoonCountBox.Text=tostring(p) platoonSizeBox.Text=tostring(each) local pn,pe,gap=previewPlatoons() if pn then launch(armyActions.spawnPlatoons,pn,pe,gap) end end textButton(scriptsPage,'2 × 16',16,2209,180,40,function() deployPreset(2,16) end) textButton(scriptsPage,'4 × 24',213,2209,180,40,function() deployPreset(4,24) end) textButton(scriptsPage,'8 × 24',410,2209,180,40,function() deployPreset(8,24) end) textButton(scriptsPage,'12 × 24',606,2209,190,40,function() deployPreset(12,24) end) textButton(scriptsPage,'DEPLOY CUSTOM PLATOONS',16,2261,780,42,function() local pn,pe,gap=previewPlatoons() if pn then launch(armyActions.spawnPlatoons,pn,pe,gap) else state('Fix the platoon count, soldiers per platoon, or gap.',false) end end) textButton(scriptsPage,'PARADE BLOCKS',16,2315,250,40,function() launch(moveFormation,'parade') end) textButton(scriptsPage,'PLATOON COLUMN',282,2315,246,40,function() launch(moveFormation,'platoon_column') end) textButton(scriptsPage,'PLATOON WEDGE',544,2315,252,40,function() launch(moveFormation,'platoon_wedge') end) textButton(scriptsPage,'BATTLEFRONT',16,2367,780,40,function() launch(moveFormation,'battlefront') end) label(scriptsPage,'Deploy presets create up to 384 real F3X models (2,688 parts). This may take minutes and some games have tighter limits. Existing FOLLOW, MARCH, HALT and REMOVE still apply.',16,2419,780,93,13,AMBER) task.spawn(function() while gui.Parent do task.wait(movementTime()) if not gui.Parent then break end if (armyFollow or armyOrbit) and not armyBusy and #currentArmy()>0 then local endpoint,problem=endpointForArmy() if not endpoint then stopModes() state('Automatic movement stopped: '..tostring(problem),false) else armyBusy=true local ok,err=pcall(function() local hrp=getRoot() local soldiers=currentArmy() local n=#soldiers if armyOrbit then orbitAngle=orbitAngle+.18 end local mode=armyOrbit and 'orbit' or armyMode local targets={} for i,record in ipairs(soldiers) do targets[i]=targetFor(record,i,n,mode,hrp,orbitAngle) end advance(endpoint,targets,movementTime(),true) end) armyBusy=false if not ok then stopModes() state('Auto motion stopped: '..tostring(err):sub(1,125),false) end end end end end) config.stopArmyEventMotion=function() stopModes() armyStop=true state('Army automatic motion stopped by STOP ALL EVENTS.',true) end gui.Destroying:Connect(function() stopModes();armyStop=true end) end)() -- SETTINGS TAB: Adjustable request delays and cooldowns for this GUI session. label(settingsPage,'SETTINGS • HD ADMIN COMMAND PREFIX',16,10,710,27,19,GOLD) label(settingsPage,"Choose the prefix used by THIS GUI. It must match the game's HD Admin prefix.",16,40,770,24,13,AMBER) local prefixBox=textbox(settingsPage,'; or :',16,75,122,36) prefixBox.Text=config.commandPrefix prefixBox.TextSize=22 prefixBox.TextXAlignment=Enum.TextXAlignment.Center textButton(settingsPage,'APPLY PREFIX',155,75,200,36,function() if commandBusy then return say('Wait until the current HD Admin command sequence finishes.') end local prefix=prefixBox.Text:gsub('%s+','') if #prefix~=1 or not prefix:match('^[;:!.]$') then return say('Choose one prefix: ; : ! or .') end config.commandPrefix=prefix local persisted=false if type(writefile)=='function' then persisted=pcall(function() writefile(PREFIX_FILE,prefix) end) end hint.Text='Choose a song: '..prefix..'music → '..prefix..'volume inf → '..prefix..'pitch.' for _,control in ipairs(gui:GetDescendants()) do if control:IsA('TextButton') then if control.Text:match('^TEST [;:!.]music ONLY$') then control.Text='TEST '..config.commandPrefix..'music ONLY' elseif control.Text:match('^DISCO [;:!.]disco$') then control.Text='DISCO '..config.commandPrefix..'disco' elseif control.Text:match('^OPEN [;:!.]cmds$') then control.Text='OPEN '..config.commandPrefix..'cmds' elseif control.Text:match('^HD ADMIN: [;:!.]clone me %(SEPARATE%)$') then control.Text='HD ADMIN: '..config.commandPrefix..'clone me (SEPARATE)' end end end say('HD Admin commands now use '..prefix..' (e.g. '..prefix..'music). '.. (persisted and 'Prefix saved locally.' or 'Prefix set for this session.')..' The game must use this prefix.',true) end) textButton(settingsPage,'RESET TO ;',370,75,180,36,function() if commandBusy then return say('Wait until the current HD Admin sequence finishes.') end config.commandPrefix=';' prefixBox.Text=';' if type(writefile)=='function' then pcall(function() writefile(PREFIX_FILE,';') end) end hint.Text='Choose a song: ;music → ;volume inf → ;pitch.' for _,control in ipairs(gui:GetDescendants()) do if control:IsA('TextButton') then if control.Text:match('^TEST [;:!.]music ONLY$') then control.Text='TEST '..config.commandPrefix..'music ONLY' elseif control.Text:match('^DISCO [;:!.]disco$') then control.Text='DISCO '..config.commandPrefix..'disco' elseif control.Text:match('^OPEN [;:!.]cmds$') then control.Text='OPEN '..config.commandPrefix..'cmds' elseif control.Text:match('^HD ADMIN: [;:!.]clone me %(SEPARATE%)$') then control.Text='HD ADMIN: '..config.commandPrefix..'clone me (SEPARATE)' end end end say('GUI prefix reset to ; . The server must accept it.',true) end) label(settingsPage,'Music, Scripts, Events, Barrier Kick, and Loopkick all use this selection.',16,120,785,23,13,WHITE) label(settingsPage,'TIMING SETTINGS • BUILD SPEED',16,163,690,27,19,GOLD) label(settingsPage,'Delays apply between F3X requests and HD Admin commands.',16,188,770,24,13,AMBER) local fields={ {key='commandDelay', caption='HD command delay (0.4–5)', min=0.4,max=5, x=16,y=218}, {key='commandCooldown',caption='HD batch cooldown (1–20)',min=1,max=20,x=419,y=218}, {key='f3xDelay',caption='F3X request spacing (0.18–3)',min=0.18,max=3,x=16,y=290}, {key='decalCooldown',caption='Single decal cooldown (2–30)',min=2,max=30,x=419,y=290}, {key='batchCooldown',caption='Build fill cooldown (5–60)',min=5,max=60,x=16,y=362}, {key='skyCooldown',caption='Sky dome cooldown (5–60)',min=5,max=60,x=419,y=362}, {key='realmPartDelay',caption='Realm part delay (0.12–3)',min=0.12,max=3,x=16,y=434}, {key='realmCooldown',caption='Realm cooldown (8–90)',min=8,max=90,x=419,y=434}, } local settingBoxes={} for _,field in ipairs(fields) do label(settingsPage,field.caption,field.x,field.y,377,24,14,WHITE) local input=textbox(settingsPage,'Seconds',field.x,field.y+27,367,30) input.Text=tostring(config[field.key]) settingBoxes[field.key]=input end local function redrawSettings() for _,field in ipairs(fields) do settingBoxes[field.key].Text=tostring(config[field.key]) end end textButton(settingsPage,'SAVE SETTINGS',16,526,185,40,function() local nextValues={} for _,field in ipairs(fields) do local entry=settingBoxes[field.key].Text:gsub('%s+','') local value=tonumber(entry) if not value or value~=value or valuefield.max or value==math.huge then return say(field.caption..' must be between '..field.min..' and '..field.max..' seconds.') end nextValues[field.key]=value end for k,v in pairs(nextValues) do config[k]=v end redrawSettings() say('Settings saved for this GUI session. HD delay='..config.commandDelay..'s, F3X delay='..config.f3xDelay..'s.',true) end) textButton(settingsPage,'RESET DEFAULTS',218,526,185,40,function() for k,v in pairs(defaults) do if k~='commandPrefix' then config[k]=v end end redrawSettings() say('Timing settings reset to safe defaults.',true) end) label(settingsPage,'Timing resets when re-running. Prefix is saved if local file storage exists.',420,523,385,45,12,QUIET) -- Interface preferences sit above command timing settings; older settings move down. do for _,item in ipairs(settingsPage:GetChildren()) do if item:IsA('GuiObject') then local pos=item.Position item.Position=UDim2.new(pos.X.Scale,pos.X.Offset,pos.Y.Scale,pos.Y.Offset+395) end end settingsPage.CanvasSize=UDim2.fromOffset(0,1080) label(settingsPage,'APPEARANCE',16,9,780,29,20,GOLD) label(settingsPage,'Color theme',16,42,400,22,13,QUIET) local themeChoices={ {'rose','Rose Graphite'},{'midnight','Midnight Blue'}, {'gold','Obsidian Gold'},{'cyan','Circuit Cyan'}, {'lilac','Soft Violet'},{'paper','Paper Light'}, {'forest','Forest Moss'},{'ember','Ember Black'}, {'mono','Monochrome'},{'sunset','Sunset Coral'}, {'frost','Arctic Glass'},{'terminal','Terminal Green'}, } local themeButtons={} local layoutChoices={ {'classic','Classic tabs'},{'left','Left sidebar'}, {'right','Right sidebar'},{'compact','Compact'}, {'tworow','Two-row tabs'},{'bottom','Bottom dock'}, {'wide','Wide workspace'}, } local layoutButtons={} local function refreshAppearance() for _,entry in ipairs(themeButtons) do local selected=config.appearanceStore.theme==entry.id entry.button.BackgroundColor3=selected and config.activeColor or DARK entry.button.TextColor3=selected and GOLD or WHITE end for _,entry in ipairs(layoutButtons) do local selected=config.appearanceStore.layout==entry.id entry.button.BackgroundColor3=selected and config.activeColor or DARK entry.button.TextColor3=selected and GOLD or WHITE end end for i,entry in ipairs(themeChoices) do local index=i local btn=textButton(settingsPage,entry[2],16+((index-1)%3)*263, 69+math.floor((index-1)/3)*42,248,35,function() config.applyAppearanceTheme(entry[1]);refreshAppearance() say('Appearance: '..entry[2]..'.',true) end) themeButtons[#themeButtons+1]={id=entry[1],button=btn} end label(settingsPage,'Layout / seven workspace arrangements',16,259,550,22,13,QUIET) for i,entry in ipairs(layoutChoices) do local btn=textButton(settingsPage,entry[2],16+((i-1)%4)*196,286+math.floor((i-1)/4)*43,185,36,function() config.applyAppearanceLayout(entry[1]);refreshAppearance() say('Layout: '..entry[2]..'.',true) end) layoutButtons[#layoutButtons+1]={id=entry[1],button=btn} end -- Honor saved preferences; the selection persists while the GUI is running, -- and across sessions if the host supports file APIs. config.applyAppearanceTheme(config.appearanceStore.theme) config.applyAppearanceLayout(config.appearanceStore.layout) refreshAppearance() end -- EVENTS TAB: an opt-in, ordered command sequencer for authorized use. -- Preset 1 is baked into the file and always recoverable even without file APIs. -- No permission bypass: HD Admin ranks and F3X SyncAPI server checks remain in charge. -- Each event is finite; it never loops, floods remotes, or deletes an unrelated map. local HttpService = game:GetService('HttpService') local EVENT_FILE = 'RetroF3X_Event_Preset1.json' local EVENT_ACTIONS = { {id='realm',title='Build Pixel Hall (BTools)',hint='Enclosed avatar-themed hall with wings, roof and animation'}, {id='owner_map',title='Switch to Pixel Hall (BTools)',hint='Same F3X build workflow as MAPS; old presets supported'}, {id='music',title='Music + volume + pitch',hint='selected, song 1–24, or audio ID'}, {id='sparkles',title='Sparkles',hint='Player selector (default me)'}, {id='smoke',title='Smoke',hint='Player selector (default me)'}, {id='fire',title='Fire',hint='Player selector (default me)'}, {id='disco',title='Disco',hint='No argument needed'}, {id='unrank',title='Unrank Others',hint='Requires explicit run confirmation and admin permission'}, {id='bring',title='Bring All',hint='Requires explicit run confirmation and admin permission'}, {id='god',title='God Me',hint='Player selector (default me)'}, {id='sky',title='Pixel BTools Sky Dome',hint='Optional sky image ID; blank = selected Pixel Sky'}, {id='message',title='Announcement ;message',hint='Blank = announcement field above'}, {id='beacon',title='Neon Realm Beacon',hint='Requires an existing BTools Realm'}, {id='army_spawn',title='F3X Clone Army — Spawn',hint='Soldier count (1–384)'}, {id='army_platoons',title='Army — Deploy Platoons',hint='Platoons x size, e.g. 4x24, up to 12x32'}, {id='army_line',title='Army Formation — Line',hint='No argument needed'}, {id='army_v',title='Army Formation — V',hint='No argument needed'}, {id='army_circle',title='Army Formation — Circle',hint='No argument needed'}, {id='army_grid',title='Army Formation — Grid',hint='No argument needed'}, {id='army_shield',title='Army Formation — Shield Wall',hint='No argument needed'}, {id='army_follow',title='Army — Toggle Smooth Follow',hint='F3X motion; turn on or off'}, {id='army_orbit',title='Army — Toggle Orbit',hint='F3X motion; turn on or off'}, {id='army_halt',title='Army — Halt / Guard',hint='Stop automatic motion'}, {id='army_march',title='Army — March',hint='Distance in studs (2–50)'}, {id='army_remove',title='Army — Remove',hint='Removes only soldiers created by this GUI'}, {id='decal1',title='Pixel Decal 1 (BTools)',hint='Applies ID 93544399411478 to selected part or first realm pieces'}, {id='decal2',title='Pixel Decal 2 (BTools)',hint='Applies ID 87626606643966 to selected part or first realm pieces'}, {id='stopdisco',title='Stop Disco',hint='No argument needed'}, {id='unmusic',title='Stop Music',hint='No argument needed'}, {id='cataclysm',title='Robux Staff Cataclysm',hint='8x titan, huge staff slam, giant blast zone, kills + building damage'}, {id='black_hole',title='Event Horizon — Black Hole',hint='F3X singularity, sky eclipse, debris orbit, shockwave, crater'}, } local EVENT_BY_ID={} for _,a in ipairs(EVENT_ACTIONS) do EVENT_BY_ID[a.id]=a end local function makeDefaultEvent() return { name='Preset 1 — ITS TIMEEEE', announcement='ITS TIMEEEE', steps={ {kind='realm',arg='',delay=1.5}, {kind='music',arg='selected',delay=1.5}, {kind='sparkles',arg='all',delay=1.5}, {kind='smoke',arg='all',delay=1.5}, {kind='fire',arg='all',delay=1.5}, {kind='disco',arg='',delay=1.5}, {kind='unrank',arg='',delay=1.5}, {kind='bring',arg='',delay=1.5}, {kind='god',arg='me',delay=1.5}, {kind='sky',arg='',delay=1.5}, {kind='message',arg='',delay=0}, } } end local function cloneEvent(ev) local c={name=ev.name,announcement=ev.announcement,steps={}} for _,step in ipairs(ev.steps) do table.insert(c.steps,{kind=step.kind,arg=step.arg,delay=step.delay}) end return c end local function cleanEvent(raw) if type(raw)~='table' then return nil end local cleaned={name=tostring(raw.name or 'Preset 1'):sub(1,45), announcement=tostring(raw.announcement or 'ITS TIMEEEE'):sub(1,130),steps={}} if type(raw.steps)~='table' then return nil end for _,s in ipairs(raw.steps) do if #cleaned.steps>=40 then break end if type(s)=='table' and EVENT_BY_ID[s.kind] then local n=tonumber(s.delay) if not n or n~=n or n==math.huge then n=1.5 end n=math.clamp(n,0,60) table.insert(cleaned.steps,{kind=s.kind,arg=tostring(s.arg or ''):sub(1,140),delay=n}) end end if #cleaned.steps==0 then return nil end return cleaned end local eventPreset=makeDefaultEvent() local fileLoadSuccess=false if type(readfile)=='function' then local ok,raw=pcall(function() return readfile(EVENT_FILE) end) if ok and type(raw)=='string' then local success,parsed=pcall(function() return HttpService:JSONDecode(raw) end) local cleaned=success and cleanEvent(parsed) if cleaned then local oldKinds={'realm','music','sparkles','smoke','fire','disco','unrank','bring','god','sky','message'} local oldDefault=(#cleaned.steps==#oldKinds) if oldDefault then for i,k in ipairs(oldKinds) do if cleaned.steps[i].kind~=k then oldDefault=false;break end end end if oldDefault and cleaned.steps[3].arg=='me' and cleaned.steps[4].arg=='me' and cleaned.steps[5].arg=='me' and cleaned.steps[9].arg=='me' then cleaned.steps[3].arg='all' cleaned.steps[4].arg='all' cleaned.steps[5].arg='all' end eventPreset=cleaned;fileLoadSuccess=true end end end local eventData=cloneEvent(eventPreset) local eventRunning=false local cancelEvent=false local playerImpactAllowed=false config.cancelEventSequencer=function() if eventRunning then cancelEvent=true end end label(eventPage,'EVENT SEQUENCER • CUSTOM ORDER + DELAYS',14,6,715,27,17,GOLD) local eventName=textbox(eventPage,'Preset title',14,37,225,30) eventName.Text=eventData.name local eventAnnouncement=textbox(eventPage,'Announcement text (;message)',248,37,545,30) eventAnnouncement.Text=eventData.announcement local eventStatus=label(eventPage,'Preset 1 ready. Choose a song under MUSIC before running.',14,366,580,21,13,GREEN) local eventScroller=ui('ScrollingFrame',{ Position=UDim2.fromOffset(14,121),Size=UDim2.fromOffset(785,237), BackgroundColor3=DARK,BorderSizePixel=0,ScrollBarThickness=8, ScrollBarImageColor3=GOLD,CanvasSize=UDim2.fromOffset(0,0), ScrollingDirection=Enum.ScrollingDirection.Y, },eventPage) stroke(eventScroller,SOFT) local eventLayout=ui('UIListLayout',{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},eventScroller) local eventMenu=ui('Frame',{ Position=UDim2.fromOffset(204,87),Size=UDim2.fromOffset(385,270), BackgroundColor3=Color3.fromRGB(37,37,42),ZIndex=30, Visible=false,BorderSizePixel=0, },eventPage) stroke(eventMenu,GOLD,2) local menuScroller=ui('ScrollingFrame',{ Position=UDim2.fromOffset(6,35),Size=UDim2.fromOffset(373,229), CanvasSize=UDim2.fromOffset(0,#EVENT_ACTIONS*35),ScrollBarThickness=7, BackgroundTransparency=1,BorderSizePixel=0,ZIndex=31, },eventMenu) label(eventMenu,'CHOOSE AN EVENT ACTION',8,4,325,28,14,GOLD).ZIndex=31 textButton(eventMenu,'×',341,2,33,29,function() eventMenu.Visible=false end).ZIndex=32 local menuTarget=nil local drawEventRows local function setEventStatus(textValue,good) eventStatus.Text=tostring(textValue):sub(1,175) eventStatus.TextColor3=good and GREEN or AMBER say(textValue,good) end for index, action in ipairs(EVENT_ACTIONS) do local thisAction=action local btn=textButton(menuScroller,action.title,2,(index-1)*35,347,32,function() if not eventRunning and menuTarget and eventData.steps[menuTarget] then eventData.steps[menuTarget].kind=thisAction.id eventData.steps[menuTarget].arg=(thisAction.id=='music' and 'selected') or ((thisAction.id=='sparkles' or thisAction.id=='smoke' or thisAction.id=='fire') and 'all') or (thisAction.id=='god' and 'me') or '' menuTarget=nil eventMenu.Visible=false drawEventRows() end end) btn.ZIndex=32 btn.TextSize=13 end local function formatActionArg(kind) if kind=='music' then return 'selected / song 1-36 / audio ID' end if kind=='message' then return 'Leave blank to use announcement text' end if kind=='sky' then return 'Pixel Sky ID (blank = selected)' end if kind=='sparkles' or kind=='smoke' or kind=='fire' then return 'all / player selector' end if kind=='god' then return 'me / player selector' end if kind=='decal1' or kind=='decal2' then return 'realm / selected' end return '(no parameter)' end local function changeStepPosition(i,offset) if eventRunning then return end local j=i+offset if j<1 or j>#eventData.steps then return end eventData.steps[i],eventData.steps[j]=eventData.steps[j],eventData.steps[i] drawEventRows() end drawEventRows=function() for _,child in ipairs(eventScroller:GetChildren()) do if child:IsA('Frame') then child:Destroy() end end for index, step in ipairs(eventData.steps) do local i=index local rowFrame=ui('Frame',{ LayoutOrder=i,Size=UDim2.fromOffset(765,49),BackgroundColor3=PANEL, BorderSizePixel=0, },eventScroller) label(rowFrame,tostring(i)..'.',5,11,25,22,13,GOLD) local actionBtn=textButton(rowFrame,EVENT_BY_ID[step.kind].title,29,4,235,41,function() if eventRunning then return end menuTarget=i eventMenu.Visible=true end) actionBtn.TextSize=12 local argBox=textbox(rowFrame,formatActionArg(step.kind),273,4,240,41) argBox.Text=step.arg or '' argBox.TextSize=12 argBox.FocusLost:Connect(function() if eventData.steps[i]==step then step.arg=argBox.Text:sub(1,140) end end) local dBox=textbox(rowFrame,'s',520,4,66,41) dBox.Text=tostring(step.delay) dBox.TextSize=12 dBox.FocusLost:Connect(function() if eventData.steps[i]~=step then return end local n=tonumber(dBox.Text) if n and n==n and n>=0 and n<=60 then step.delay=n else dBox.Text=tostring(step.delay) end end) local up=textButton(rowFrame,'↑',593,6,36,37,function() changeStepPosition(i,-1) end) local down=textButton(rowFrame,'↓',636,6,36,37,function() changeStepPosition(i,1) end) local del=textButton(rowFrame,'×',679,6,35,37,function() if eventRunning then return end if #eventData.steps==1 then return setEventStatus('Keep at least one action in the event.') end table.remove(eventData.steps,i) drawEventRows() end) up.TextSize=16; down.TextSize=16; del.TextSize=16 end eventScroller.CanvasSize=UDim2.fromOffset(0,#eventData.steps*53+6) end local function readEventForm() local current=cloneEvent(eventData) current.name=eventName.Text:sub(1,45) current.announcement=eventAnnouncement.Text:sub(1,130) for i, rowFrame in ipairs((function() local rows={} for _,child in ipairs(eventScroller:GetChildren()) do if child:IsA('Frame') then table.insert(rows,child) end end table.sort(rows,function(a,b) return a.LayoutOrder60 then return nil,'Step '..i..': delay must be from 0 to 60 seconds.' end current.steps[i].arg=arg:sub(1,140) current.steps[i].delay=delay end return cleanEvent(current) end local function refreshEventFields() eventName.Text=eventData.name eventAnnouncement.Text=eventData.announcement eventMenu.Visible=false drawEventRows() end local function saveEvent() if eventRunning then return setEventStatus('Stop the active event before saving.') end local nextEvent,err=readEventForm() if not nextEvent then return setEventStatus(err or 'Invalid event setup.') end eventData=nextEvent eventPreset=cloneEvent(nextEvent) local persisted=false if type(writefile)=='function' then local ok=pcall(function() writefile(EVENT_FILE,HttpService:JSONEncode(eventPreset)) end) persisted=ok end setEventStatus(persisted and 'Preset 1 saved locally; loads next run.' or 'Preset 1 saved for this session. Your executor does not provide local file saving.',true) drawEventRows() end local function waitJobClear(field,timeoutSeconds) local start=os.clock() while field() and gui.Parent and not cancelEvent do if os.clock()-start>timeoutSeconds then return false,'Timed out waiting for F3X.' end task.wait(0.2) end if cancelEvent or not gui.Parent then return false,'Event canceled.' end return true end local function eventCommand(cmd) if not gui.Parent or cancelEvent then return false,'Canceled.' end local ok,detail=submitHDAdminCommand(cmd) if not ok then return false,tostring(detail) end return true end local function runEventStep(step,announcement) local kind=step.kind local arg=tostring(step.arg or ''):gsub('^%s+',''):gsub('%s+$','') if kind=='realm' then if #liveRealmParts()>0 then return true,'Existing F3X realm reused' end local _,endpoint,problem=detectBuildTool() if not endpoint then return false,problem or 'F3X not equipped' end createRealm('PIXEL') local ok,err=waitJobClear(function() return realmBusy end,180) if not ok then return false,err end if not lastRealmResult.ok then return false,'BTools Realm failed: '..tostring(lastRealmResult.detail) end return true,'BTools Pixel Realm created' elseif kind=='owner_map' then local _,endpoint,problem=detectBuildTool() if not endpoint then return false,problem or 'F3X/BTools not available' end local started=createRealm('PIXEL',true,{replace=true,quality=2,label='Pixel Hall'}) if not started then return false,'BTools map could not start; check the GUI status' end local ok,err=waitJobClear(function() return realmBusy end,180) if not ok then return false,err end return lastRealmResult.ok,'Pixel Hall: '..tostring(lastRealmResult.detail) elseif kind=='sky' then local sky=normalizeAssetId(arg) or selectedRealmSky if f3xSkyPart and f3xSkyPart.Parent then return true,'Existing sky dome reused' end local _,endpoint,problem=detectBuildTool() if not endpoint then return false,problem or 'F3X not equipped' end skyIdBox.Text=sky createF3XSkyDome() local ok,err=waitJobClear(function() return busy end,90) if not ok then return false,err end if not (f3xSkyPart and f3xSkyPart.Parent) then return false,'Sky dome not confirmed.' end return true,'F3X sky creation requested' elseif kind=='beacon' then createBeacon() return waitJobClear(function() return realmBusy end,90) elseif kind=='decal1' or kind=='decal2' then local id=(kind=='decal1' and '93544399411478' or '87626606643966') local _,endpoint,problem=detectBuildTool() if not endpoint then return false,problem or 'BTools not available' end local parts={} if arg=='selected' then if selectedPart and selectedPart:IsA('BasePart') and selectedPart:IsDescendantOf(workspace) and not isPlayerCharacterPart(selectedPart) then parts={selectedPart} end else for _,part in ipairs(liveRealmParts()) do table.insert(parts,part) if #parts>=6 then break end end end if #parts==0 then return false,'Select a part or build Pixel Realm first.' end local ok,attempted,confirmed=pcall(function() return applyServerF3XDecals(parts,FACES,id,endpoint) end) if not ok then return false,'BTools decal error: '..tostring(attempted) end if confirmed==0 then return false,'Decal not confirmed on any parts.' end return true,'BTools decal '..id..' applied ('..confirmed..'/'..attempted..' faces)' elseif kind=='army_spawn' then return armyActions.spawn(tonumber(arg) or 4) elseif kind=='army_platoons' then local p,n=tostring(arg or ''):match('^(%d+)%s*[xX]%s*(%d+)$') return armyActions.spawnPlatoons(tonumber(p) or 4,tonumber(n) or 24,24) elseif kind=='army_line' or kind=='army_v' or kind=='army_circle' or kind=='army_grid' or kind=='army_shield' then return armyActions.formation((kind=='army_line' and 'line') or (kind=='army_v' and 'v') or (kind=='army_circle' and 'circle') or (kind=='army_shield' and 'shield') or 'grid') elseif kind=='army_follow' then return armyActions.follow() elseif kind=='army_orbit' then return armyActions.orbit() elseif kind=='army_halt' then return armyActions.halt() elseif kind=='army_march' then return armyActions.march(tonumber(arg) or 15) elseif kind=='army_remove' then return armyActions.remove() elseif kind=='cataclysm' then if not runCataclysmEvent then return false,'Cataclysm module unavailable' end return runCataclysmEvent() elseif kind=='black_hole' then if type(config.runBlackHoleEvent)~='function' then return false,'Black Hole module unavailable' end return config.runBlackHoleEvent() elseif kind=='music' then local id local pitch if arg=='' or string.lower(arg)=='selected' then id=songIds[selectedSong];pitch=selectedPitch(selectedSong) else local n=tonumber(arg) if n and n>=1 and n<=#SONGS and n%1==0 then id=songIds[n];pitch=selectedPitch(n) else id=normalizeAssetId(arg);pitch=1 end end if not id then return false,'No audio ID for selected song.' end local commands={';music '..id,';volume inf',';pitch '..tostring(pitch)} for i,cmd in ipairs(commands) do local ok,err=eventCommand(cmd) if not ok then return false,err end if i<#commands then task.wait(config.commandDelay) end end return true,'Music submitted ('..id..')' else local command if kind=='sparkles' or kind=='smoke' or kind=='fire' or kind=='god' then local target=(arg~='' and arg or 'me') if not target:match('^[%w_,]+$') then return false,'Invalid player selector.' end command=';'..kind..' '..target elseif kind=='disco' then command=';disco' elseif kind=='stopdisco' then command=';undisco' elseif kind=='unrank' then command=';unrank others' elseif kind=='bring' then command=';bring all' elseif kind=='unmusic' then command=';unmusic' elseif kind=='message' then local txt=(arg~='' and arg or announcement) if txt=='' then return false,'Announcement is blank.' end txt=txt:gsub('[\r\n]',' '):sub(1,130) command=';message '..txt end if not command then return false,'Unknown event action.' end return eventCommand(command) end end local function eventNeedsImpactConfirmation(ev) for _,step in ipairs(ev.steps) do if step.kind=='unrank' or step.kind=='bring' then return true end if (step.kind=='sparkles' or step.kind=='smoke' or step.kind=='fire') and string.lower(tostring(step.arg or ''))=='all' then return true end end return false end local function executeEvent() if config.eventEmergencyActive then return setEventStatus('STOP ALL cleanup in progress. Please finish cleanup before running another event.') end if eventRunning or commandBusy or busy or realmBusy then return setEventStatus('A music, F3X, or event operation is already running.') end local snapshot,err=readEventForm() if not snapshot then return setEventStatus(err or 'Invalid event configuration.') end if eventNeedsImpactConfirmation(snapshot) and not playerImpactAllowed then return setEventStatus('Confirm the player-impact checkbox before server-wide effects / player commands.') end eventRunning=true;commandBusy=true;cancelEvent=false playerImpactAllowed=false local steps=snapshot.steps setEventStatus('Starting '..snapshot.name..' ('..#steps..' steps)...',true) task.spawn(function() local problems={} for index,step in ipairs(steps) do if cancelEvent or not gui.Parent then break end local action=EVENT_BY_ID[step.kind] local statusName=action and action.title or step.kind setEventStatus('Event '..index..'/'..#steps..': '..statusName,true) local ok,result=pcall(function() return runEventStep(step,snapshot.announcement) end) if not ok then table.insert(problems,index..': '..tostring(result):sub(1,65)) elseif result==false then table.insert(problems,index..': action denied / unavailable') end if index<#steps and not cancelEvent then -- Each step has its own configurable delay before the next. local duration=step.delay local elapsed=0 while elapsed0 then setEventStatus('Event finished with '..#problems..' possible issues. Check HD Admin/F3X permissions.') warn('[Pixel GUI Events] '..table.concat(problems,' | ')) else setEventStatus('Event commands submitted! Server still decides which effects applied.',true) end end end) end textButton(eventPage,'LOAD PRESET 1',14,77,146,36,function() if eventRunning then return end eventData=cloneEvent(eventPreset) refreshEventFields() setEventStatus('Loaded Preset 1. You can edit, reorder, add, or remove steps.',true) end) textButton(eventPage,'SAVE PRESET 1',169,77,146,36,saveEvent) textButton(eventPage,'+ ADD STEP',323,77,128,36,function() if eventRunning then return end if #eventData.steps>=40 then return setEventStatus('Limit: 40 actions per event.') end table.insert(eventData.steps,{kind='disco',arg='',delay=1.5}) drawEventRows() eventScroller.CanvasPosition=Vector2.new(0,math.max(0,eventScroller.CanvasSize.Y.Offset-237)) menuTarget=#eventData.steps eventMenu.Visible=true end) textButton(eventPage,'▶ EXECUTE',458,77,157,36,executeEvent) textButton(eventPage,'■ CANCEL',624,77,169,36,function() if not eventRunning then return setEventStatus('No event is running.') end cancelEvent=true setEventStatus('Cancel requested. In-flight server commands cannot be recalled.') end) local impactCheck impactCheck=textButton(eventPage,'☐ CONFIRM ALL-PLAYER ACTIONS',14,391,300,32,function() playerImpactAllowed=not playerImpactAllowed impactCheck.Text=playerImpactAllowed and '☑ ALL-PLAYER ACTIONS CONFIRMED' or '☐ CONFIRM ALL-PLAYER ACTIONS' end) impactCheck.TextSize=12 label(eventPage,'Admin permissions apply. Delays follow each step.',324,391,265,34,12,AMBER) -- Quick access through the Scripts tab, using the exact same event runner. textButton(scriptsPage,'▶ RUN PRESET 1',16,345,192,35,function() activateTab('events') executeEvent() end) textButton(scriptsPage,'EDIT EVENT STEPS',215,345,188,35,function() activateTab('events') setEventStatus('Edit actions, arguments, and per-step delays here.',true) end) refreshEventFields() if fileLoadSuccess then setEventStatus('Restored your saved event preset from local storage.',true) end -- SCRIPTS TAB: Shortcut Builder / Favorites / category navigation. -- Existing shortcuts remain below this editor; the client can only request commands -- that the current player is authorized to use on the game server. ;(function() local HttpService=game:GetService('HttpService') local STORE_PATH='PixelGUI_CustomShortcuts_v1.json' local MAX_SHORTCUTS=32 local MAX_COMMANDS=12 local BUILDER_SHIFT=700 local categories={'CUSTOM','WORLD','PLAYER','EVENTS','UTILITIES'} local savedShortcuts={} local editId=nil local filterFavorites=false local selectedCategory='CUSTOM' local cancelCustomRun=false local customRunning=false local confirmDeleteId=nil local listRows={} -- Shift only the existing script controls; don't move the new builder controls. for _,child in ipairs(scriptsPage:GetChildren()) do if child:IsA('GuiObject') then local pos=child.Position child.Position=UDim2.new(pos.X.Scale,pos.X.Offset,pos.Y.Scale,pos.Y.Offset+BUILDER_SHIFT) end end scriptsPage.CanvasSize=UDim2.fromOffset(0,2530+BUILDER_SHIFT) local function trim(s) return tostring(s or ''):match('^%s*(.-)%s*$') or '' end local function categoryValid(cat) for _,v in ipairs(categories) do if cat==v then return true end end return false end local function normalCommand(s) s=trim(s) if s=='' or #s>160 or s:find('[\r\n%z]') then return nil end local first=s:sub(1,1) if first==';' or first==':' or first=='!' or first=='.' then s=';'..trim(s:sub(2)) else s=';'..s end if #s<=1 or not s:match('^;[%a][%w_]*') then return nil end return s end local function validRecord(row) if type(row)~='table' then return nil end local name=trim(row.name) if #name<1 or #name>36 or type(row.commands)~='table' then return nil end if #row.commands<1 or #row.commands>MAX_COMMANDS then return nil end local commands={} for _,v in ipairs(row.commands) do local command=normalCommand(v) if not command then return nil end commands[#commands+1]=command end local category=categoryValid(row.category) and row.category or 'CUSTOM' return { id=type(row.id)=='string' and row.id:sub(1,60) or HttpService:GenerateGUID(false), name=name, commands=commands, category=category, favorite=row.favorite==true, } end local function readStored() local source=nil if type(readfile)=='function' then local ok,stored=pcall(function() return readfile(STORE_PATH) end) if ok and type(stored)=='string' and #stored<65000 then local decodedOK,decoded=pcall(function() return HttpService:JSONDecode(stored) end) if decodedOK and type(decoded)=='table' then source=type(decoded.shortcuts)=='table' and decoded.shortcuts or decoded end end end if not source and type(env.__PixelGUI_CustomShortcuts)=='table' then source=env.__PixelGUI_CustomShortcuts end if type(source)=='table' then for _,raw in ipairs(source) do if #savedShortcuts>=MAX_SHORTCUTS then break end local value=validRecord(raw) if value then savedShortcuts[#savedShortcuts+1]=value end end end end local function persist() env.__PixelGUI_CustomShortcuts=savedShortcuts if type(writefile)~='function' then return false end local ok=pcall(function() writefile(STORE_PATH,HttpService:JSONEncode({schema=1,shortcuts=savedShortcuts})) end) return ok end readStored() label(scriptsPage,'SCRIPT SHORTCUTS • PIXEL GUI',16,8,790,33,19,GOLD) label(scriptsPage,'Create your own commands and sequences • one command per line • normal game permissions apply.',16,40,790,23,12,AMBER) local navTargets={CUSTOM=0,WORLD=BUILDER_SHIFT+73,PLAYER=BUILDER_SHIFT+203, EVENTS=BUILDER_SHIFT+340,UTILITIES=BUILDER_SHIFT+1260} for i,cat in ipairs(categories) do local button=textButton(scriptsPage,cat,16+(i-1)*158,68,148,32,function() scriptsPage.CanvasPosition=Vector2.new(0,navTargets[cat]) end) button.TextSize=12 end label(scriptsPage,'CUSTOM SHORTCUT BUILDER',16,112,535,29,17,GOLD) local saveInfo=label(scriptsPage,'Loading saved shortcuts...',16,143,780,22,12,QUIET) local shortcutName=textbox(scriptsPage,'Shortcut name (e.g. Pixel Party)',16,183,366,37) shortcutName.TextSize=14 local categoryBtn categoryBtn=textButton(scriptsPage,'CATEGORY: CUSTOM',16,233,185,36,function() local idx=1 for i,v in ipairs(categories) do if v==selectedCategory then idx=i break end end selectedCategory=categories[(idx%#categories)+1] categoryBtn.Text='CATEGORY: '..selectedCategory end) categoryBtn.TextSize=12 label(scriptsPage,'COMMANDS (ONE PER LINE)',16,281,388,22,13,WHITE) local commandEditor=textbox(scriptsPage,';message Welcome to Team Pixel!\n;disco',16,308,367,164) commandEditor.MultiLine=true commandEditor.TextWrapped=false commandEditor.TextYAlignment=Enum.TextYAlignment.Top commandEditor.TextSize=14 local editorInfo=label(scriptsPage,'Up to 12 lines; each command runs with your normal rank.',16,481,370,35,12,QUIET) local listTitle=label(scriptsPage,'SAVED SHORTCUTS',411,182,380,29,17,GOLD) local listFrame=ui('ScrollingFrame',{ Position=UDim2.fromOffset(411,249),Size=UDim2.fromOffset(383,338), BackgroundColor3=DARK,BorderSizePixel=0,ScrollBarThickness=7, ScrollBarImageColor3=GOLD,CanvasSize=UDim2.fromOffset(0,0), ScrollingDirection=Enum.ScrollingDirection.Y, },scriptsPage) stroke(listFrame,SOFT) local refreshList local function setCustomStatus(msg,good) editorInfo.Text=tostring(msg):sub(1,160) editorInfo.TextColor3=good and GREEN or AMBER say(msg,good) end local function getSelected() if editId==nil then return nil end for _,v in ipairs(savedShortcuts) do if v.id==editId then return v end end return nil end local function clearEditor() editId=nil shortcutName.Text='' commandEditor.Text='' selectedCategory='CUSTOM' categoryBtn.Text='CATEGORY: CUSTOM' end local function loadEditor(item) editId=item.id shortcutName.Text=item.name selectedCategory=item.category categoryBtn.Text='CATEGORY: '..selectedCategory commandEditor.Text=table.concat(item.commands,'\n') scriptsPage.CanvasPosition=Vector2.new(0,0) setCustomStatus('Editing '..item.name..'. Press SAVE to update.',true) end local function runCustom(item) if customRunning or commandBusy or os.clock()-requestCooldown0 then setCustomStatus('Finished '..item.name..': '..failed..' command(s) failed to send.',false) else setCustomStatus('Sent '..completed..' command(s). The server decides if they take effect.',true) end end) end local function deleteRecord(id) for i,item in ipairs(savedShortcuts) do if item.id==id then table.remove(savedShortcuts,i) if editId==id then clearEditor() end persist() refreshList() return setCustomStatus('Shortcut deleted.',true) end end end local filterBtn filterBtn=textButton(scriptsPage,'SHOW: ALL',411,217,383,27,function() filterFavorites=not filterFavorites filterBtn.Text=filterFavorites and 'SHOW: FAVORITES ★' or 'SHOW: ALL' refreshList() end) filterBtn.TextSize=12 refreshList=function() for _,row in ipairs(listRows) do if row.Parent then row:Destroy() end end listRows={} local shown={} for _,item in ipairs(savedShortcuts) do if not filterFavorites or item.favorite then shown[#shown+1]=item end end table.sort(shown,function(a,b) if a.favorite~=b.favorite then return a.favorite end return a.name:lower()36 then return setCustomStatus('Shortcut name must be 1–36 characters.',false) end local raw=commandEditor.Text:gsub('\r\n','\n'):gsub('\r','\n') local lines={} for line in (raw..'\n'):gmatch('(.-)\n') do if trim(line)~='' then local cleaned=normalCommand(line) if not cleaned then return setCustomStatus('Invalid command line or over 160 characters.',false) end lines[#lines+1]=cleaned if #lines>MAX_COMMANDS then return setCustomStatus('Maximum 12 commands per shortcut.',false) end end end if #lines==0 then return setCustomStatus('Enter at least one command.',false) end local existing=getSelected() if not existing and #savedShortcuts>=MAX_SHORTCUTS then return setCustomStatus('Maximum 32 shortcuts saved.',false) end if existing then existing.name=name existing.commands=lines existing.category=selectedCategory else local row={id=HttpService:GenerateGUID(false),name=name, commands=lines,category=selectedCategory,favorite=false} savedShortcuts[#savedShortcuts+1]=row editId=row.id end confirmDeleteId=nil filterFavorites=false filterBtn.Text='SHOW: ALL' local saved=persist() refreshList() setCustomStatus(saved and 'Shortcut saved to local file.' or 'Shortcut saved for this session (local file saving unavailable).',true) end).TextSize=12 textButton(scriptsPage,'NEW / CLEAR',205,523,177,39,function() clearEditor() setCustomStatus('Ready for a new shortcut.',true) end).TextSize=12 config.cancelCustomEventSequence=function() if customRunning then cancelCustomRun=true end end textButton(scriptsPage,'STOP CUSTOM SEQUENCE',16,576,366,37,function() if not customRunning then return setCustomStatus('No custom shortcut is running.',false) end cancelCustomRun=true setCustomStatus('Cancellation requested. In-flight command cannot be recalled.',false) end).TextSize=12 label(scriptsPage,'Custom commands use the prefix from SETTINGS. Use only commands you have permission to run.',16,625,779,45,12,AMBER) label(scriptsPage,'EXISTING SHORTCUTS / PLAYER TOOLS ↓',16,681,780,19,12,GOLD) refreshList() end)() -- TITAN WINGSUIT: huge visual wings constructed and animated with authorized -- F3X/BTools parts. Unlike a character accessory, anchored parts are moved -- in deliberate server-authorized steps and cannot grant flight physics. ;(function() local MAX_RUN_SECONDS=60 local MAX_FRAMES=28 local WINGS_Y=3300 scriptsPage.CanvasSize=UDim2.fromOffset(0,3920) local wingState=label(scriptsPage, 'TITAN WINGSUIT • MASSIVE F3X FEATHER WINGS',16,WINGS_Y,775,32,18,GOLD) label(scriptsPage, '300+ stud wingspan • pearl / gold / pink highlights • two articulated wing fans.', 16,WINGS_Y+37,779,45,13,WHITE) local wingStatus=label(scriptsPage,'Wings: not built. Equip F3X/BTools to create them.', 16,WINGS_Y+89,776,43,13,GREEN) label(scriptsPage, 'FOLLOW + FLAP moves anchored BTools pieces in steps for up to 60 seconds. ' ..'Not a welded wearable or a flying tool. Only your authorized F3X edits can replicate.', 16,WINGS_Y+317,777,84,12,AMBER) textButton(scriptsPage,'TITAN WINGS ↓',411,576,383,37,function() scriptsPage.CanvasPosition=Vector2.new(0,WINGS_Y-20) end).TextSize=13 local function state(message,success) if wingStatus.Parent then wingStatus.Text=tostring(message) wingStatus.TextColor3=(success==false) and AMBER or GREEN end say('Titan Wings: '..tostring(message),success~=false) end local function aliveRecords() local records={} for _,record in ipairs(wingRegistry.records) do if record.part and validRealmPart(record.part) then records[#records+1]=record end end wingRegistry.records=records return records end local function wingEndpoint() local _,endpoint,problem=detectBuildTool() if not endpoint then error(problem or 'Equip server-authorized F3X first.') end return endpoint end local function call(endpoint,action,...) local ok,res=pcall(function(...) return endpoint:InvokeServer(action,...) end,...) if not ok then error('F3X '..action..': '..tostring(res),2) end if res==false then error('F3X refused '..action,2) end return res end local function getRoot() local character=player.Character local hrp=character and character:FindFirstChild('HumanoidRootPart') if not hrp then error('Character not ready. Spawn first.') end return hrp end local function wingPieces() local pieces={} local M=Enum.Material local pearl=Color3.fromRGB(236,235,246) local ivory=Color3.fromRGB(199,206,230) local gold=Color3.fromRGB(222,173,84) local rose=Color3.fromRGB(239,132,185) local charcoal=Color3.fromRGB(36,36,48) local glow=Color3.fromRGB(250,207,237) local function push(side,x,y,z,w,h,d,color,material,rx,ry,rz) pieces[#pieces+1]={side=side,x=x,y=y,z=z, size=Vector3.new(w,h,d),color=color,material=material, twist=CFrame.Angles(math.rad(rx or 0),math.rad(ry or 0),math.rad(rz or 0))} end -- Back harness and crest; player-sized components stay central. push(0,0,0,0,8,8,3,charcoal,M.Metal) push(0,0,3.6,1,5,2,2,gold,M.Metal) push(0,0,4.9,1.3,2,2.2,2,rose,M.Neon,0,45,0) push(0,0,-3.3,0,7,1.1,2,ivory,M.Metal) for _,side in ipairs({-1,1}) do -- Six large primary bones per wing, with a separate sweeping -- feather and bright feather-edge on every section. for i=1,6 do local x=(i-.5)*23 local y=1.5+(i-1)*.65 local z=3.5+(i-1)*2.7 push(side,x,y,z,26,3.8,7,gold,M.Metal,0,side*7,side*3) local featherLength=33+i*5 push(side,x,-2.1+(i*.4),z+featherLength*.37, 11,2.2,featherLength,(i%2==0) and pearl or ivory, M.SmoothPlastic,6,side*(9+i),side*2) push(side,x,-.1+(i*.4),z+featherLength*.55, 5.2,1,featherLength*.7,rose,M.Neon,4,side*(9+i),side*2) end -- Long pointed outer feathers make the silhouette enormous. for i=1,4 do local x=120+i*8 push(side,x,-1+i*1.3,12+i*12,8,2,52-i*7, (i%2==0) and pearl or gold,M.Metal,0,side*(13+i*3),side*7) end -- Shoulder gems + a hub at the wing root. push(side,4,1.4,3,12,9,9,charcoal,M.Metal) push(side,6,1.5,7,6,6,6,glow,M.Neon,0,45,0) end return pieces end local function pose(piece,root,angle) -- The same 320-stud wings sit at shoulder height when Titan Mode is active. local character=player.Character local shoulder=character and character:FindFirstChild('UpperTorso') local origin=(shoulder and shoulder.CFrame or root*CFrame.new(0,1.35,0))*CFrame.new(0,0,2.2) if piece.side==0 then return origin*CFrame.new(piece.x,piece.y,piece.z)*piece.twist end -- Opposite Z rotation on each side gives symmetric flapping motion. return origin*CFrame.new(piece.side*3.4,1.15,0) *CFrame.Angles(0,0,piece.side*angle) *CFrame.new(piece.side*piece.x,piece.y,piece.z)*piece.twist end local function stopAnimation() wingRegistry.serial=(tonumber(wingRegistry.serial) or 0)+1 end local function moveWings(endpoint,root,angle,serial) local records=aliveRecords() local batch={} for index,record in ipairs(records) do if not gui.Parent or wingRegistry.serial~=serial then return false end batch[#batch+1]={Part=record.part,CFrame=pose(record.spec,root,angle)} if #batch==12 or index==#records then call(endpoint,'SyncMove',batch) batch={} if index<#records then task.wait(math.max(.15,config.f3xDelay)) end end end return true end local function animate() if wingRegistry.busy then return state('Finish the current wings operation first.',false) end if #aliveRecords()==0 then return state('Build your Titan Wings first.',false) end stopAnimation() local serial=wingRegistry.serial wingRegistry.busy=true task.spawn(function() local ok,err=pcall(function() local endpoint=wingEndpoint() local started=os.clock() for frame=1,MAX_FRAMES do if not gui.Parent or wingRegistry.serial~=serial then break end if os.clock()-started>=MAX_RUN_SECONDS then break end local root=getRoot().CFrame local angle=.15+.34*(.5+.5*math.sin(frame*.87)) if not moveWings(endpoint,root,angle,serial) then break end if frame%3==0 then state('Flapping + following: frame '..frame..'/'..MAX_FRAMES..'.',true) end task.wait(1.45) end end) wingRegistry.busy=false if gui.Parent then state(ok and 'Flap session finished / stopped. Wings remain deployed.' or ('Animation stopped: '..tostring(err):sub(1,120)),ok) end end) end local function setPose(angle,caption) if wingRegistry.busy then return state('Stop the current wings operation first.',false) end if #aliveRecords()==0 then return state('Build your Titan Wings first.',false) end stopAnimation() local serial=wingRegistry.serial wingRegistry.busy=true task.spawn(function() local ok,err=pcall(function() local ep=wingEndpoint() moveWings(ep,getRoot().CFrame,angle,serial) end) wingRegistry.busy=false if gui.Parent then state(ok and caption or ('Pose failed: '..tostring(err):sub(1,120)),ok) end end) end local function createWings() if busy or realmBusy or wingRegistry.busy then return state('Finish the existing BTools operation first.',false) end if #aliveRecords()>0 then return state('Wings already exist. Remove them first.',false) end wingRegistry.busy=true wingRegistry.cancel=false stopAnimation() task.spawn(function() local ok,err=pcall(function() local endpoint=wingEndpoint() local root=getRoot().CFrame local specs=wingPieces() local records={} local resize,colors,materials,collision={},{},{},{} state('Building '..#specs..' massive wing pieces through F3X...',true) for i,spec in ipairs(specs) do if not gui.Parent or wingRegistry.cancel then error('Build cancelled') end local cf=pose(spec,root,.22) local part=call(endpoint,'CreatePart','Normal',cf,workspace) if not validRealmPart(part) then error('CreatePart did not return a BasePart at '..i) end local record={part=part,spec=spec} records[#records+1]=record -- Track immediately so even a partial build is removable. wingRegistry.records[#wingRegistry.records+1]=record resize[#resize+1]={Part=part,CFrame=cf,Size=spec.size} colors[#colors+1]={Part=part,Color=spec.color,UnionColoring=false} materials[#materials+1]={Part=part,Material=spec.material} collision[#collision+1]={Part=part,CanCollide=false} if i%8==0 or i==#specs then state('Creating wings '..i..'/'..#specs..'...') end if i<#specs then task.wait(math.max(.14,config.f3xDelay)) end end local jobs={{'SyncResize',resize},{'SyncColor',colors}, {'SyncMaterial',materials},{'SyncCollision',collision}} for _,job in ipairs(jobs) do for start=1,#job[2],12 do if not gui.Parent or wingRegistry.cancel then error('Styling cancelled') end local batch={} for index=start,math.min(start+11,#job[2]) do batch[#batch+1]=job[2][index] end call(endpoint,job[1],batch) task.wait(math.max(.14,config.f3xDelay)) end end state('Titan Wings created! 320-stud span. Starting F3X flapping...',true) end) wingRegistry.busy=false if ok and gui.Parent and not wingRegistry.cancel then -- Auto-start one rate-limited flapping session after construction. task.delay(1.2,function() if gui.Parent and not wingRegistry.cancel and #aliveRecords()>0 then animate() end end) elseif not ok and gui.Parent then state('Wings stopped: '..tostring(err):sub(1,145)..'. REMOVE clears partial builds.',false) end end) end local function removeWings() if wingRegistry.busy then -- A running animation or build will halt at the next request. wingRegistry.cancel=true stopAnimation() return state('Stop requested. When current operation finishes, press REMOVE again.',false) end if #aliveRecords()==0 then return state('No tracked wings to remove.',false) end stopAnimation() wingRegistry.busy=true task.spawn(function() local ok,err=pcall(function() local endpoint=wingEndpoint() local parts={} for _,record in ipairs(aliveRecords()) do parts[#parts+1]=record.part end for start=1,#parts,12 do local batch={} for i=start,math.min(start+11,#parts) do batch[#batch+1]=parts[i] end call(endpoint,'Remove',batch) task.wait(math.max(.16,config.f3xDelay)) end aliveRecords() end) wingRegistry.busy=false if gui.Parent then state(ok and ('Wings removed. Remaining: '..#aliveRecords()..' pieces.') or ('Remove failed: '..tostring(err):sub(1,145)),ok) end end) end textButton(scriptsPage,'CREATE TITAN WINGS (F3X)',16,WINGS_Y+144,376,43,createWings) textButton(scriptsPage,'FLAP + FOLLOW (60 SEC)',410,WINGS_Y+144,386,43,animate) textButton(scriptsPage,'EXTEND / RECENTER',16,WINGS_Y+198,252,40,function() setPose(.12,'Wings extended behind your character.') end) textButton(scriptsPage,'FOLD WINGS',280,WINGS_Y+198,250,40,function() setPose(1.05,'Wings folded upward behind your character.') end) textButton(scriptsPage,'STOP FLAPPING',544,WINGS_Y+198,252,40,function() wingRegistry.cancel=true stopAnimation() state('Flapping stop requested. Current F3X move may finish.',true) end) textButton(scriptsPage,'REMOVE TITAN WINGS',16,WINGS_Y+255,375,43,removeWings) textButton(scriptsPage,'CHECK BTOOLS',410,WINGS_Y+255,386,43,function() local tool,ep,problem=detectBuildTool() state(ep and ('Ready: '..tool.Name..' / F3X SyncAPI') or tostring(problem),ep~=nil) end) if #aliveRecords()>0 then state('Recovered '..#wingRegistry.records..' tracked wing pieces from this server.',true) end end)() -- TITAN MODE: wear the mech on YOUR actual R15 character, not a loose F3X shell. -- HD Admin commands are permission-gated; decorative local armor is not replicated -- unless the optional PixelTitanWearable.server.lua companion is installed by the owner. local function initWearableTitanMode() local Y=3810 local M=Enum.Material local C={black=Color3.fromRGB(24,24,35),panel=Color3.fromRGB(46,44,64), pearl=Color3.fromRGB(235,229,241),gold=Color3.fromRGB(229,181,84), pink=Color3.fromRGB(247,133,208),cyan=Color3.fromRGB(107,225,249), violet=Color3.fromRGB(149,96,233),white=Color3.fromRGB(252,244,253)} local beams={ {name='PINK',outer=C.pink,inner=C.white}, {name='CYAN',outer=C.cyan,inner=C.white}, {name='GOLD',outer=C.gold,inner=C.white}, {name='VIOLET',outer=C.violet,inner=C.white}, } local beamColor=1 local lastBeam=0 scriptsPage.CanvasSize=UDim2.fromOffset(0,Y+600) label(scriptsPage,'TITAN MODE • BECOME THE MECH',16,Y,780,32,19,GOLD) label(scriptsPage,'R15 check → HD Admin BTools → actual avatar size → wearable mech armor.',16,Y+35,780,30,13,WHITE) local titanStatus=label(scriptsPage,'Ready. Wearable armor attaches to your own character.',16,Y+69,779,49,13,GREEN) label(scriptsPage,'Mech armor welds to your R15 limbs: no follower or stationary shell. In games without the' ..' optional server companion the armor is LOCAL ONLY; HD Admin size may replicate.',16,Y+405,782,55,12,AMBER) label(scriptsPage,'FIRE LASER is a manual F3X neon beam. Any ;kill request still requires your normal' ..' HD Admin permissions and is sent only once to an exact detected target.',16,Y+465,782,58,12,AMBER) local function state(message,good) if titanStatus.Parent then titanStatus.Text=tostring(message):sub(1,210) titanStatus.TextColor3=good==false and AMBER or GREEN end say('Titan Mode: '..tostring(message):sub(1,160),good~=false) end local function characterHumanoid() local character=player.Character local humanoid=character and character:FindFirstChildOfClass('Humanoid') return character,humanoid end local function getRoot() local c,h=characterHumanoid() local root=c and c:FindFirstChild('HumanoidRootPart') if not root or not h or h.Health<=0 then error('Spawn your character first.') end return root,c,h end local function waitForR15(seconds) local start=os.clock() while gui.Parent and not titanRegistry.cancel and os.clock()-start<(seconds or 12) do local c,h=characterHumanoid() if c and h and h.Health>0 and h.RigType==Enum.HumanoidRigType.R15 and c:FindFirstChild('UpperTorso') and c:FindFirstChild('HumanoidRootPart') then return c,h end task.wait(.35) end return nil end local function request(command) local ok,detail=submitHDAdminCommand(command) if not ok then error(withHDAdminPrefix(command)..' failed: '..tostring(detail),2) end return detail end local function getEndpoint() local _,ep,problem=detectBuildTool() if not ep then error(problem or 'Server-authorized F3X/BTools required.',2) end return ep end local function f3xCall(ep,action,...) local ok,res=pcall(function(...) return ep:InvokeServer(action,...) end,...) if not ok then error(action..': '..tostring(res),2) end if res==false then error('The server denied F3X '..action,2) end return res end local function wipeArmor() local c=player.Character local folder=c and c:FindFirstChild('PixelTitanArmor') if folder then folder:Destroy() end local remote=ReplicatedStorage:FindFirstChild('PixelTitanWearable') if remote and remote:IsA('RemoteEvent') then remote:FireServer('Remove') end titanRegistry.enabled=false return folder~=nil end local function addWearablePart(folder,limbName,partName,off,multipliers,color,material) local limb=folder.Parent and folder.Parent:FindFirstChild(limbName) if not (limb and limb:IsA('BasePart')) then return end local p=Instance.new('Part') p.Name=partName p.Size=Vector3.new( math.max(.12,limb.Size.X*multipliers.X), math.max(.12,limb.Size.Y*multipliers.Y), math.max(.12,limb.Size.Z*multipliers.Z)) p.Material=material or M.Metal p.Color=color p.TopSurface=Enum.SurfaceType.Smooth p.BottomSurface=Enum.SurfaceType.Smooth p.Anchored=false p.CanCollide=false p.CanQuery=false p.CanTouch=false p.Massless=true p.CastShadow=false p.CFrame=limb.CFrame*CFrame.new( limb.Size.X*off.X,limb.Size.Y*off.Y,limb.Size.Z*off.Z) p.Parent=folder local weld=Instance.new('WeldConstraint') weld.Part0=limb weld.Part1=p weld.Parent=p end local function localArmor(character) local previous=character:FindFirstChild('PixelTitanArmor') if previous then previous:Destroy() end local folder=Instance.new('Folder') folder.Name='PixelTitanArmor' folder:SetAttribute('PixelTitanLocal',true) folder.Parent=character local function piece(limb,n,off,sz,col,mat) addWearablePart(folder,limb,n,off,sz,col,mat) end local V=Vector3.new -- Armor pieces are welded to REAL R15 body parts, so they move with walking -- and jumping instead of snapping after a slow F3X SyncMove batch. piece('UpperTorso','Titan Breastplate',V(0,0,-.16),V(1.25,1.1,1.12),C.panel) piece('UpperTorso','Glowing Chest Core',V(0,.02,-.81),V(.42,.48,.1),C.pink,M.Neon) piece('UpperTorso','Chest Core Inlay',V(0,.02,-.89),V(.22,.24,.05),C.white,M.Neon) piece('LowerTorso','Titan Waist',V(0,0,-.10),V(1.22,1.06,1.19),C.black) piece('Head','Titan Helm Crest',V(0,.51,0),V(1.2,.27,1.2),C.gold) piece('Head','Titan Helm Brow',V(0,.24,-.55),V(1.23,.2,.22),C.black) piece('Head','Crown Spike',V(0,.82,0),V(.2,.75,.24),C.pink,M.Neon) for _,side in ipairs({'Left','Right'}) do local arm=side..'UpperArm' local low=side..'LowerArm' local hand=side..'Hand' local thigh=side..'UpperLeg' local shin=side..'LowerLeg' local foot=side..'Foot' piece(arm,side..' Shoulder',V(0,.28,0),V(1.65,.67,1.8),C.gold) piece(arm,side..' Shoulder Light',V(0,.35,-.74),V(1.1,.22,.16),C.pink,M.Neon) piece(low,side..' Gauntlet',V(0,0,0),V(1.3,1.05,1.3),C.panel) piece(hand,side..' Fist',V(0,0,-.1),V(1.26,1.12,1.35),C.gold) piece(thigh,side..' Leg Armor',V(0,0,-.04),V(1.25,1.04,1.29),C.panel) piece(shin,side..' Shin Plate',V(0,0,-.16),V(1.31,1.0,1.3),C.black) piece(foot,side..' Armored Boot',V(0,-.10,-.14),V(1.22,1.17,1.33),C.gold) end return folder end local function attachArmor(character) local previous=character:FindFirstChild('PixelTitanArmor') if previous and previous:GetAttribute('PixelTitanLocal') then previous:Destroy() end local serverRemote=ReplicatedStorage:FindFirstChild('PixelTitanWearable') if serverRemote and serverRemote:IsA('RemoteEvent') then serverRemote:FireServer('Equip') task.wait(1.2) local sharedArmor=character:FindFirstChild('PixelTitanArmor') if sharedArmor and not sharedArmor:GetAttribute('PixelTitanLocal') then return 'Server-replicated armor' end end localArmor(character) return 'Local-only wearable armor' end local function ensureR15AndBtools() local c,h=characterHumanoid() if not h or h.Health<=0 then error('Spawn before transforming.') end if h.RigType~=Enum.HumanoidRigType.R15 then state('R6 detected: requesting '..withHDAdminPrefix(';r15 me')..' ...',true) request(';r15 me') c,h=waitForR15(14) if not c then error('R15 was not confirmed. Check HD Admin permission and game rig restrictions.') end else state('R15 detected: no rig conversion needed.',true) end if titanRegistry.cancel then error('Canceled') end local _,toolEndpoint=findEquippedF3X() if not toolEndpoint then state('Giving BTools: requesting '..withHDAdminPrefix(';buildingtools me')..' ...',true) request(';buildingtools me') local started=os.clock() repeat if titanRegistry.cancel then error('Canceled') end task.wait(.4) _,toolEndpoint=findEquippedF3X() until toolEndpoint or os.clock()-started>=10 if not toolEndpoint then error('F3X/BTools not confirmed after 10 sec. HD Admin may have denied the command.') end else state('Existing F3X/BTools detected; skipping duplicate give.',true) end return c end local function become(size) if titanRegistry.busy then return state('Finish the current Titan transformation first.',false) end if busy or realmBusy then return state('Finish the current F3X operation first.',false) end if size~=4 and size~=8 and size~=12 then return end titanRegistry.busy=true titanRegistry.cancel=false task.spawn(function() local ok,err=pcall(function() ensureR15AndBtools() if titanRegistry.cancel then error('Canceled') end state('R15 + BTools ready. Requesting '..size..'x actual avatar size...',true) request(';size me '..size) task.wait(2.2) local c,h=characterHumanoid() if not c or not h or h.RigType~=Enum.HumanoidRigType.R15 then error('Character changed during size operation; retry after respawning.') end local mode=attachArmor(c) titanRegistry.enabled=true titanRegistry.size=size state('You are the mech! '..mode..'. Sent '..size..'x size; confirm it visually. Recenter Titan Wings.',true) end) titanRegistry.busy=false if not ok and gui.Parent then state('Transformation stopped: '..tostring(err):sub(1,150),false) end end) end local function resetTitan() if titanRegistry.busy then return state('Wait for the current transformation to finish.',false) end wipeArmor() local ok,detail=submitHDAdminCommand(';size me 1') state(ok and 'Removed armor; requested normal avatar size. Server decides.' or ('Armor removed; normal size request failed: '..tostring(detail)),ok) end local function refreshArmor() local c,h=characterHumanoid() if not c or not h or h.RigType~=Enum.HumanoidRigType.R15 then return state('Must be R15. Use BECOME TITAN first.',false) end task.spawn(function() local mode=attachArmor(c) titanRegistry.enabled=true state('Armor reapplied: '..mode..'.',true) end) end local function cleanupOldShell() if titanRegistry.busy then return state('Wait for the active Titan operation.',false) end local records={} for _,rec in ipairs(titanRegistry.records) do if rec.part and validRealmPart(rec.part) then records[#records+1]=rec.part end end if #records==0 then return state('No old F3X follower shell remains.',true) end titanRegistry.busy=true task.spawn(function() local ok,err=pcall(function() local ep=getEndpoint() for first=1,#records,12 do local batch={} for i=first,math.min(first+11,#records) do batch[#batch+1]=records[i] end f3xCall(ep,'Remove',batch) task.wait(math.max(.14,config.f3xDelay)) end titanRegistry.records={} end) titanRegistry.busy=false state(ok and 'Old F3X follower shell removed; wearable Titan remains.' or ('Old shell cleanup failed: '..tostring(err):sub(1,110)),ok) end) end local function shoot() if titanRegistry.laserBusy or os.clock()-lastBeam<3 then return state('Laser cooling down (3 seconds).',false) end local root,character,h=getRoot() if h.RigType~=Enum.HumanoidRigType.R15 then return state('Use BECOME TITAN first; laser requires R15.',false) end local head=character:FindFirstChild('Head') local origin=(head and head.Position or root.Position)+root.CFrame.LookVector*4 local exclude={character} for _,record in ipairs(wingRegistry.records) do if record.part and validRealmPart(record.part) then exclude[#exclude+1]=record.part end end local params=RaycastParams.new() params.FilterType=Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances=exclude params.IgnoreWater=true local pointer=mouse.UnitRay local cursorHit=workspace:Raycast(pointer.Origin,pointer.Direction*950,params) local aim=cursorHit and cursorHit.Position or pointer.Origin+pointer.Direction*500 local difference=aim-origin if difference.Magnitude<1 then difference=root.CFrame.LookVector*500 end local dir=difference.Unit*math.min(difference.Magnitude,500) local hit=workspace:Raycast(origin,dir,params) local hitPoint=hit and hit.Position or origin+dir local target=nil if hit then local model=hit.Instance:FindFirstAncestorOfClass('Model') target=model and Players:GetPlayerFromCharacter(model) if target==player then target=nil end end -- A direct, exact-player hit; no scanning/loop-kill behavior. titanRegistry.laserBusy=true lastBeam=os.clock() local selected=beams[beamColor] task.spawn(function() local parts={} local ep=nil local ok,err=pcall(function() ep=getEndpoint() local length=(hitPoint-origin).Magnitude if length<1 then error('Laser path too short') end local cf=CFrame.lookAt((origin+hitPoint)/2,hitPoint) local resizes,colors,mats,collisions={},{},{},{} for _,spec in ipairs({ {size=Vector3.new(7,7,length),color=selected.outer}, {size=Vector3.new(2.4,2.4,length),color=selected.inner}, }) do local part=f3xCall(ep,'CreatePart','Normal',cf,workspace) if not validRealmPart(part) then error('Laser part was not created') end parts[#parts+1]=part resizes[#resizes+1]={Part=part,CFrame=cf,Size=spec.size} colors[#colors+1]={Part=part,Color=spec.color,UnionColoring=false} mats[#mats+1]={Part=part,Material=M.Neon} collisions[#collisions+1]={Part=part,CanCollide=false} end for _,job in ipairs({{'SyncResize',resizes},{'SyncColor',colors}, {'SyncMaterial',mats},{'SyncCollision',collisions}}) do f3xCall(ep,job[1],job[2]) task.wait(math.max(.12,config.f3xDelay)) end if target and target.Parent==Players then local tc=target.Character local tr=tc and tc:FindFirstChild('HumanoidRootPart') local stillHit=false if tr then local along=(tr.Position-origin):Dot(dir.Unit) local close=origin+dir.Unit*math.clamp(along,0,length) stillHit=along>=0 and along<=length+3 and (tr.Position-close).Magnitude<=8 end if stillHit then local cmd=';kill '..target.Name local success,detail=submitHDAdminCommand(cmd) state(success and ('Laser hit '..target.Name..'. Sent permitted command; server decides.') or ('Target hit, but command denied: '..tostring(detail)),success) else state('Laser fired; target moved out of range.',true) end else state('Laser fired; no player directly hit.',true) end task.wait(1.35) end) pcall(function() if #parts>0 then f3xCall(ep or getEndpoint(),'Remove',parts) end end) titanRegistry.laserBusy=false if not ok and gui.Parent then state('Laser failed: '..tostring(err):sub(1,130),false) end end) end textButton(scriptsPage,'BECOME TITAN: 8×',16,Y+127,376,43,function() become(8) end) textButton(scriptsPage,'BECOME TITAN: 4×',410,Y+127,386,43,function() become(4) end) textButton(scriptsPage,'MEGA TITAN: 12×',16,Y+181,376,43,function() become(12) end) textButton(scriptsPage,'RESET SIZE + ARMOR',410,Y+181,386,43,resetTitan) textButton(scriptsPage,'REAPPLY MECH ARMOR',16,Y+235,376,40,refreshArmor) textButton(scriptsPage,'REMOVE MECH ARMOR',410,Y+235,386,40,function() wipeArmor() state('Wearable armor removed; your avatar size was not changed.',true) end) textButton(scriptsPage,'FIRE TITAN LASER',16,Y+289,376,45,shoot) local beamButton beamButton=textButton(scriptsPage,'BEAM: PINK',410,Y+289,386,45,function() beamColor=beamColor%#beams+1 beamButton.Text='BEAM: '..beams[beamColor].name state('Laser color: '..beams[beamColor].name,true) end) textButton(scriptsPage,'GO TO TITAN WINGS ↑',16,Y+348,376,39,function() scriptsPage.CanvasPosition=Vector2.new(0,3280) end) textButton(scriptsPage,'CLEAN OLD FOLLOWER SHELL',410,Y+348,386,39,cleanupOldShell) textButton(scriptsPage,'STOP TRANSFORMATION',16,Y+535,780,34,function() titanRegistry.cancel=true state('Stop requested. A command already accepted by the server cannot be canceled.',true) end) -- Re-running Pixel GUI while still transformed should not create another shell. local c,h=characterHumanoid() if c and c:FindFirstChild('PixelTitanArmor') and h and h.RigType==Enum.HumanoidRigType.R15 then titanRegistry.enabled=true state('Your wearable Titan armor is already attached.',true) end end initWearableTitanMode() -- ROBUX STAFF CATACLYSM. Runs with normal authorized HD Admin and F3X/BTools. -- Visual landscape replacement is NEW, TRACKED BTools construction: it does not -- delete arbitrary Terrain voxels, unrelated Workspace parts, or player builds. -- The cinematic staff is an F3X-built replica positioned at the avatar's back, -- raised into its hand, then driven into the impact point using SyncMove. -- The local cinematic uses per-render-frame interpolation. F3X server updates -- use one grouped SyncMove per sampled pose, without flooding the server. ;(function() local M=Enum.Material local COLORS={ black=Color3.fromRGB(16,15,23),charcoal=Color3.fromRGB(30,28,42), slate=Color3.fromRGB(48,43,62),stone=Color3.fromRGB(72,65,89), pearl=Color3.fromRGB(206,196,226),gold=Color3.fromRGB(234,186,79), green=Color3.fromRGB(93,237,120),mint=Color3.fromRGB(168,255,180), purple=Color3.fromRGB(151,87,223),rose=Color3.fromRGB(231,92,179), ember=Color3.fromRGB(248,112,85),white=Color3.fromRGB(252,237,254), } local registry=env.__PixelGUI_StaffCataclysm if type(registry)~='table' or registry.sessionKey~=mapSessionKey then registry={sessionKey=mapSessionKey,parts={},busy=false,cancel=false,serial=0} env.__PixelGUI_StaffCataclysm=registry end if type(registry.parts)~='table' then registry.parts={} end -- Re-executing Pixel GUI must not leave an old client-side preview behind. if typeof(registry.visualModel)=='Instance' then pcall(function() registry.visualModel:Destroy() end) end registry.visualModel=nil registry.visualOwner=nil if type(registry.clearImpactVisual)=='function' then pcall(registry.clearImpactVisual) end if type(registry.staffHidden)=='table' then for part,modifier in pairs(registry.staffHidden) do if typeof(part)=='Instance' and part.Parent then pcall(function() part.LocalTransparencyModifier=modifier end) end end end registry.staffHidden={} registry.serial=(tonumber(registry.serial) or 0)+1 registry.busy=false registry.cancel=false registry.impactAnimating=false local runSerial=registry.serial local lastStart=-999 local statusLine=label(eventPage,'Ready. Uses your HD Admin + equipped F3X/BTools.',16,493,780,50,14,GREEN) label(eventPage,'ROBUX STAFF CATACLYSM • CINEMATIC TITAN EVENT',16,447,780,35,18,GOLD) label(eventPage,'Smooth staff animation, then an expanding neon impact shockwave, flash and debris. Both the ruined terrain and the shared F3X impact effects are fully prebuilt off-map before the staff moves.',16,548,784,58,13,WHITE) label(eventPage,'Only NEW, TRACKED F3X scenery is created. Original terrain is not deleted or carved.',16,927,784,45,12,AMBER) local function report(msg,ok) if gui.Parent and statusLine.Parent then statusLine.Text=tostring(msg):sub(1,240) statusLine.TextColor3=(ok==false) and AMBER or GREEN say('Cataclysm: '..tostring(msg):sub(1,140),ok~=false) if ok==false then warn('[Pixel GUI / Staff Cataclysm] '..tostring(msg)) end end end local function checkActive() if not gui.Parent or registry.cancel or registry.serial~=runSerial then error('Event canceled. Existing F3X parts remain tracked for cleanup.',2) end end local function invoke(ep,action,...) checkActive() local args={...} local ok,result=pcall(function() return ep:InvokeServer(action,table.unpack(args)) end) if not ok then error('F3X '..action..': '..tostring(result),2) end if result==false then error('F3X rejected '..action,2) end return result end -- Retry rejected F3X requests in a bounded way; never automatically -- repeat a nil or unparented BasePart result, since it may have spawned. local function cataclysmCreatePart(ep,cf,caption,index,count) local lastProblem='unknown' for attempt=1,4 do checkActive() local ok,p=pcall(function() return ep:InvokeServer('CreatePart','Normal',cf,workspace) end) if ok and typeof(p)=='Instance' and p:IsA('BasePart') then local deadline=os.clock()+1.5 while not p:IsDescendantOf(workspace) and os.clock()deadline end if not ep then error('No F3X SyncAPI found. Equip F3X Building Tools first. '..tostring(why),2) end report('F3X detected. Requesting 8× size (optional)...',true) local sent,detail=submitHDAdminCommand(';size me 8') if not sent then report('8× size request unavailable; continuing with full-scale staff.',true) end -- The HD Admin remote acknowledging a command is not proof that the -- game enlarged the character. It is safe to continue without it. task.wait(.35) char=player.Character or char root=char:FindFirstChild('HumanoidRootPart') or root return ep,root,char end local function spec(x,y,z,w,h,d,color,material,collide,rx,ry,rz) return { offset=Vector3.new(x,y,z),size=Vector3.new(w,h,d), color=color,material=material or M.Slate,collide=collide~=false, rot=(rx or ry or rz) and CFrame.Angles(math.rad(rx or 0), math.rad(ry or 0),math.rad(rz or 0)) or CFrame.new(), } end local function staffSpecs() local result={} -- Noncollidable staff pieces avoid flinging the player's character -- while the F3X assembly sweeps through its cinematic poses. local function put(...) local item=spec(...) item.collide=false result[#result+1]=item end -- Robux-themed staff: dark shaft, golden clasps, green hollow hex gem. put(0,-21,0,5,79,5,COLORS.black,M.Metal) put(0,-20,-2.7,1.3,70,.7,COLORS.gold,M.Neon,false) put(0,-62,0,13,9,13,COLORS.gold,M.Metal) put(0,-55,0,9,6,9,COLORS.green,M.Neon) put(0,17,0,11,9,10,COLORS.gold,M.Metal) put(0,28,0,20,15,7,COLORS.green,M.Metal) put(0,29,-4,13,11,1,COLORS.black,M.SmoothPlastic,false) put(0,29,-5,8,7,1,COLORS.mint,M.Neon,false) for _,side in ipairs({-1,1}) do put(side*14,29,0,5,23,5,COLORS.gold,M.Metal,false,0,0,side*25) put(side*11,43,0,4,12,4,COLORS.green,M.Neon,false,0,0,side*-35) put(side*7,13,0,4,14,4,COLORS.green,M.Neon,false,0,0,side*30) end put(0,50,0,8,12,8,COLORS.gold,M.Metal,false) put(0,58,0,4,10,4,COLORS.mint,M.Neon,false) return result end local function wastelandSpecs() local result={} local function put(...) result[#result+1]=spec(...) end -- Much larger ruined terrain overlay: about a 1050+ stud blast zone. put(0,-4,0,1080,8,1080,COLORS.black,M.Slate,true) for x=-5,5 do for z=-5,5 do if not (math.abs(x)<=1 and math.abs(z)<=1) then local ring=math.max(math.abs(x),math.abs(z)) local h=4+(ring%4)*1.7 local shiftX=((z*19+x*7)%15)-7 local shiftZ=((x*17+z*11)%15)-7 put(x*96+shiftX,h*.5,z*96+shiftZ,92,h,92, ((x+z)%3==0) and COLORS.slate or COLORS.charcoal, ((x+z)%2==0) and M.Basalt or M.Slate,true, ((x+z)%2)*2,((x*7+z*9)%11)-5,((x-z)%3)*2) end end end put(0,-2,0,270,10,270,COLORS.black,M.Basalt,true) put(0,3,0,170,1,170,COLORS.charcoal,M.CrackedLava,true) -- Multi-ring crater lips. for i=1,28 do local a=i*math.pi/14 local r=145+(i%4)*9 local x,z=math.cos(a)*r,math.sin(a)*r local h=10+(i%5)*4 put(x,h/2+1,z,46,h,34, (i%4==0) and COLORS.stone or COLORS.slate,M.Slate,true, (i%3-1)*8,math.deg(a)+90,(i%5-2)*7) if i%2==0 then put(x*.82,3,z*.82,3,.55,96,COLORS.rose,M.Neon,false,0,math.deg(a),0) end end for i=1,22 do local a=i*math.pi/11 local r=250+(i%5)*24 local x,z=math.cos(a)*r,math.sin(a)*r local h=12+(i%6)*5 put(x,h/2+1,z,52,h,36, (i%3==0) and COLORS.stone or COLORS.charcoal,M.Rock,true, ((i*9)%27)-13,math.deg(a)+90,((i*7)%25)-12) end -- Broken glowing veins radiate farther outward. for i=1,36 do local a=i*math.pi/18 local r=190+(i%6)*42 put(math.cos(a)*r,5,math.sin(a)*r,3,.5,92, (i%3==0) and COLORS.purple or COLORS.ember,M.Neon,false,0,math.deg(a),0) end -- Rocky debris piles and jagged wreckage. for i=1,46 do local a=i*2*math.pi/46 local r=265+((i*37)%175) local height=10+(i%7)*9 put(math.cos(a)*r,height/2+2,math.sin(a)*r, 14+(i%5)*5,height,12+(i%4)*6, (i%4==0) and COLORS.stone or COLORS.slate,M.Rock,true, ((i*11)%31)-15,i*23%180,((i*17)%43)-21) end for i=1,18 do local a=i*math.pi/9 local r=360+((i*21)%60) local x,z=math.cos(a)*r,math.sin(a)*r put(x,22,z,8,44,8,COLORS.black,M.Metal,false,0,i*19,12) put(x,48,z,12,9,12,(i%2==0) and COLORS.rose or COLORS.purple,M.Neon,false) end return result end -- PREBUILT IMPACT EFFECT: all shared flash/ring pieces are F3X parts. -- They are staged with the crater before the staff starts moving. local function impactEffectSpecs() local result={} local function put(item,role,index) item.role=role item.index=index item.collide=false result[#result+1]=item end for i=1,16 do local a=(i-1)*math.pi/8 local radius=43 local item=spec(math.cos(a)*radius,3,math.sin(a)*radius,19,2,7, (i%2==0) and COLORS.rose or COLORS.ember,M.Neon,false,0,90-math.deg(a),0) put(item,'ring',i) end put(spec(0,9,0,50,6,50,COLORS.white,M.Neon,false),'flash',1) put(spec(0,41,0,15,78,15,COLORS.rose,M.Neon,false),'pillar',1) for i=1,8 do local a=i*math.pi/4 local r=61+i%3*10 local shard=spec(math.cos(a)*r,13,math.sin(a)*r,8,26+i%4*8,8, (i%2==0) and COLORS.ember or COLORS.purple,M.Neon,false,0,i*21,(i%3-1)*15) put(shard,'shard',i) end return result end -- The local effect renders at the player's frame rate. Other players see -- the accompanying F3X shockwave, subject to normal server latency. registry.clearImpactVisual=function() local old=registry.impactVisual registry.impactVisual=nil if old then old.dead=true if old.model then pcall(function() old.model:Destroy() end) end end end local function startLocalImpactFlash(position) registry.clearImpactVisual() local model=Instance.new('Model') model.Name='PixelGUI_Cataclysm_Impact_Local' model.Parent=workspace local visual={model=model,dead=false} registry.impactVisual=visual local ringParts={} for ring=1,2 do for i=1,18 do local part=Instance.new('Part') part.Name='Shockwave_'..ring..'_'..i part.Anchored=true part.CanCollide=false part.CanTouch=false part.CanQuery=false part.CastShadow=false part.Material=Enum.Material.Neon part.Color=(ring==1) and COLORS.rose or COLORS.ember part.Size=Vector3.new(5,.65,4) part.Parent=model ringParts[#ringParts+1]={part=part,ring=ring,index=i} end end local flash=Instance.new('Part') flash.Name='Impact_Flash' flash.Shape=Enum.PartType.Ball flash.Anchored=true flash.CanCollide=false flash.CanTouch=false flash.CanQuery=false flash.CastShadow=false flash.Material=Enum.Material.Neon flash.Color=COLORS.white flash.Size=Vector3.new(5,5,5) flash.CFrame=CFrame.new(position+Vector3.new(0,7,0)) flash.Parent=model task.spawn(function() local RunService=game:GetService('RunService') local started=os.clock() while not visual.dead and model.Parent and gui.Parent and registry.serial==runSerial do local t=os.clock()-started if t>1.8 then break end local alpha=math.clamp(t/1.8,0,1) local fade=math.clamp((alpha-.25)/.75,0,1) for _,r in ipairs(ringParts) do local a=(r.index-1)*math.pi/9 local radius=(r.ring==1 and 25 or 65)+alpha*(r.ring==1 and 340 or 500) r.part.CFrame=CFrame.new(position+Vector3.new(math.cos(a)*radius,3,math.sin(a)*radius)) *CFrame.Angles(0,math.pi/2-a,0) r.part.Size=Vector3.new(math.max(5,radius*2*math.pi/18*.83),.65,5) r.part.Transparency=fade end local burst=12+(1-alpha)^2*78 flash.Size=Vector3.new(burst,burst,burst) flash.Transparency=math.clamp(alpha*2.4,0,1) RunService.RenderStepped:Wait() end if registry.impactVisual==visual then registry.clearImpactVisual() end end) end local function animateSharedImpact(ep,records,position) -- Small number of grouped F3X updates; don't flood the server. registry.impactAnimating=true local okay,why=pcall(function() for step=1,5 do checkActive() local radius=43+step*73 local changes={} for _,r in ipairs(records) do if r.spec.role=='ring' and validRealmPart(r.part) then local a=(r.spec.index-1)*math.pi/8 changes[#changes+1]={ Part=r.part, CFrame=CFrame.new(position+Vector3.new(math.cos(a)*radius,3,math.sin(a)*radius)) *CFrame.Angles(0,math.pi/2-a,0), Size=Vector3.new(math.max(19,radius*math.pi*2/16*.88),2,7), } end end if #changes>0 then invoke(ep,'SyncResize',changes) end task.wait(.18) end task.wait(1.0) local expired={} for _,r in ipairs(records) do if validRealmPart(r.part) then expired[#expired+1]=r.part end end for i=1,#expired,12 do local batch={} for j=i,math.min(i+11,#expired) do batch[#batch+1]=expired[j] end invoke(ep,'Remove',batch) task.wait(.1) end end) registry.impactAnimating=false if not okay and not registry.cancel then report('Impact effect F3X animation limited: '..tostring(why):sub(1,100),false) end end local function styleParts(ep,records,caption) local actions={ {'SyncResize',function(r) return {Part=r.part,CFrame=r.at,Size=r.spec.size} end}, {'SyncColor',function(r) return {Part=r.part,Color=r.spec.color,UnionColoring=false} end}, {'SyncMaterial',function(r) return {Part=r.part,Material=r.spec.material} end}, {'SyncCollision',function(r) return {Part=r.part,CanCollide=r.spec.collide} end}, } local total=#records*#actions local done=0 for _,item in ipairs(actions) do local action,asChange=item[1],item[2] for first=1,#records,10 do checkActive() local chunk={} for n=first,math.min(first+9,#records) do chunk[#chunk+1]=asChange(records[n]) end invoke(ep,action,chunk) done=done+#chunk if done%30<=10 then report(('%s: styling %d%%'):format(caption,math.floor(done/total*100)),true) end task.wait(math.max(.10,config.f3xDelay)) end end end local function createBlueprint(ep,blueprint,baseFrame,caption) local records={} local started=os.clock() for i,item in ipairs(blueprint) do checkActive() local cf=baseFrame*CFrame.new(item.offset)*item.rot local p=cataclysmCreatePart(ep,cf,caption,i,#blueprint) registry.parts[#registry.parts+1]=p if not p.Anchored then invoke(ep,'SyncAnchor',{{Part=p,Anchored=true}}) end records[#records+1]={part=p,at=cf,spec=item} if i==1 or i%8==0 or i==#blueprint then local elapsed=os.clock()-started local eta=i>0 and (elapsed/i)*(#blueprint-i) or 0 report(('%s: %d/%d parts, ~%ds ETA'):format(caption,i,#blueprint,math.ceil(eta)),true) end if i<#blueprint then task.wait(math.max(.35,config.realmPartDelay)) if i%48==0 then task.wait(2.0) end end end styleParts(ep,records,caption) return records end -- SyncAPI responses do not always mean the client's replicated Part state -- has caught up. Wait until the staged ruins are actually present and -- sized before allowing the animation to begin. local function waitForPreparedTerrain(records) local deadline=os.clock()+12 local lastReady=-1 repeat checkActive() local ready=0 for _,r in ipairs(records) do if validRealmPart(r.part) and r.part.Anchored and (r.part.Size-r.spec.size).Magnitude<0.4 then ready=ready+1 end end if ready==#records then return end if ready~=lastReady then report(('WAITING FOR RUINED TERRAIN: %d/%d replicated'):format(ready,#records),true) lastReady=ready end task.wait(.25) until os.clock()>=deadline error(('Ruined terrain is not fully ready (%d/%d pieces sized/anchored). ' ..'Check F3X permissions; use REMOVE STAFF + RUINS before retrying.') :format(lastReady,#records),2) end -- A staff contains fewer than 25 pieces. Send each pose as ONE F3X -- SyncMove batch instead of 2+ serial remote calls per animation frame. local function moveAssembly(ep,records,frame) local moves={} for _,r in ipairs(records) do if validRealmPart(r.part) then moves[#moves+1]={Part=r.part,CFrame=frame*CFrame.new(r.spec.offset)*r.spec.rot} end end if #moves==0 then error('The staff has no available F3X parts.',2) end invoke(ep,'SyncMove',moves) end -- Build, resize, color, and texture the entire ruined landscape at a -- temporary high-altitude position BEFORE animating the staff. At impact -- only the already-prepared parts need to be moved, not created anew. -- SyncMove is chunked to avoid sending hundreds of changes in one request. local function revealPreparedTerrain(ep,records,impactFrame) if #records==0 then error('No prebuilt ruins are available to reveal.',2) end local moved=0 for first=1,#records,20 do checkActive() local batch={} local current={} for i=first,math.min(first+19,#records) do local r=records[i] if not validRealmPart(r.part) then error(('Prebuilt ruin piece %d/%d went missing before impact.'):format(i,#records),2) end local at=impactFrame*CFrame.new(r.spec.offset)*r.spec.rot batch[#batch+1]={Part=r.part,CFrame=at} current[#current+1]={record=r,at=at} end invoke(ep,'SyncMove',batch) for _,entry in ipairs(current) do entry.record.at=entry.at end moved=moved+#batch if first==1 or moved==#records or moved%60==0 then report(('IMPACT: revealing prepared terrain %d/%d'):format(moved,#records),true) end if moved<#records then task.wait(math.max(.08,config.f3xDelay)) end end return moved end registry.clearSmoothStaff=function() -- An old GUI instance must not erase a newer instance's animation. if registry.visualOwner and registry.visualOwner~=runSerial then return end local model=registry.visualModel registry.visualModel=nil registry.visualOwner=nil if typeof(model)=='Instance' then pcall(function() model:Destroy() end) end if type(registry.staffHidden)=='table' then for part,modifier in pairs(registry.staffHidden) do if typeof(part)=='Instance' and part.Parent then pcall(function() part.LocalTransparencyModifier=modifier end) end end end registry.staffHidden={} end -- Client-only visual doubles are updated at the actual render rate. They -- do not need a new remote and cannot affect the shared world themselves. -- The underlying server F3X staff is temporarily hidden on this client, -- then restored at the end of the animation. registry.makeSmoothStaff=function(staff,frame) registry.clearSmoothStaff() local model=Instance.new('Model') model.Name='PixelGUI_SmoothCataclysmStaff_Local' registry.visualModel=model registry.visualOwner=runSerial local visuals={} for index,r in ipairs(staff) do local piece=Instance.new('Part') piece.Name='StaffVisual_'..index piece.Size=r.spec.size piece.Color=r.spec.color piece.Material=r.spec.material piece.Anchored=true piece.CanCollide=false piece.CanTouch=false piece.CanQuery=false piece.CastShadow=false piece.CFrame=frame*CFrame.new(r.spec.offset)*r.spec.rot piece.Parent=model visuals[#visuals+1]={part=piece,spec=r.spec} if validRealmPart(r.part) then registry.staffHidden[r.part]=r.part.LocalTransparencyModifier r.part.LocalTransparencyModifier=1 end end model.Parent=workspace return visuals end registry.renderStaffFrame=function(visuals,frame) for _,item in ipairs(visuals) do item.part.CFrame=frame*CFrame.new(item.spec.offset)*item.spec.rot end end -- One worker serializes all server updates. The render loop writes only -- its latest pose, so network latency cannot stall local animation or -- queue hundreds of obsolete positions on F3X's RemoteFunction. registry.startStaffServerDriver=function(ep,staff,initialPose) local driver={pose=initialPose,revision=0,sent=-1,stop=false,done=false,failed=nil} task.spawn(function() while not registry.cancel and gui.Parent and registry.serial==runSerial do if driver.revision~=driver.sent then local revision=driver.revision local pose=driver.pose local ok,err=pcall(moveAssembly,ep,staff,pose) if not ok then driver.failed=tostring(err) break end driver.sent=revision end if driver.stop and driver.sent==driver.revision then break end task.wait(.12) -- ~8 possible network updates/s, subject to F3X latency end driver.done=true end) return driver end registry.staffEase=function(alpha,style) if style=='slam' then return alpha*alpha*alpha*alpha end if style=='out' then return 1-(1-alpha)^3 end if style=='linear' then return alpha end return alpha*alpha*(3-2*alpha) end registry.playSmoothStaff=function(ep,staff,rootFrame,impactPosition,startFrame,onImpact) local RunService=game:GetService('RunService') local visualParts=registry.makeSmoothStaff(staff,startFrame) local driver=registry.startStaffServerDriver(ep,staff,startFrame) -- Nine timed transitions plus a short hold: reach for the back-mounted -- staff, draw it, raise overhead, charge, wind up, and strike. -- Interpolating the whole CFrame smoothly avoids the old six hard snaps. local phases={ {name='REACH BACK',duration=.48,ease='smooth',pose=rootFrame*CFrame.new(14,27,11)*CFrame.Angles(math.rad(-12),0,math.rad(-38))}, {name='GRAB STAFF',duration=.50,ease='smooth',pose=rootFrame*CFrame.new(19,27,2)*CFrame.Angles(math.rad(-18),0,math.rad(-18))}, {name='DRAW STAFF',duration=.60,ease='out',pose=rootFrame*CFrame.new(25,32,-10)*CFrame.Angles(math.rad(-29),0,math.rad(15))}, {name='RAISE STAFF',duration=.68,ease='smooth',pose=rootFrame*CFrame.new(28,50,-18)*CFrame.Angles(math.rad(-32),0,math.rad(-22))}, {name='OVERHEAD',duration=.55,ease='smooth',pose=rootFrame*CFrame.new(19,69,-25)*CFrame.Angles(math.rad(-63),0,math.rad(-20))}, {name='CHARGE',duration=.35,ease='smooth',pose=rootFrame*CFrame.new(18,74,-30)*CFrame.Angles(math.rad(-76),0,math.rad(4))}, {name='WIND UP',duration=.48,ease='smooth',pose=rootFrame*CFrame.new(18,61,-42)*CFrame.Angles(math.rad(-65),0,math.rad(26))}, {name='SWING',duration=.25,ease='linear',pose=CFrame.new(impactPosition+Vector3.new(0,112,13))*CFrame.Angles(math.rad(-28),0,math.rad(10))}, {name='FINAL STRIKE',duration=.21,ease='slam',pose=CFrame.new(impactPosition+Vector3.new(0,71,0))}, } local previous=startFrame for index,phase in ipairs(phases) do checkActive() report(('STAFF: %s (%d/%d)'):format(phase.name,index,#phases),true) local started=os.clock() while true do checkActive() local alpha=math.clamp((os.clock()-started)/phase.duration,0,1) local frame=previous:Lerp(phase.pose,registry.staffEase(alpha,phase.ease)) registry.renderStaffFrame(visualParts,frame) driver.pose=frame driver.revision=driver.revision+1 if alpha>=1 then break end RunService.RenderStepped:Wait() end previous=phase.pose if phase.name=='FINAL STRIKE' and type(onImpact)=='function' then -- Trigger local impact EXACTLY when the final animation frame lands. onImpact() end if phase.name=='CHARGE' then task.wait(.18) end end -- Hold the final render pose while the network catches up. If it -- cannot catch up, report the limitation; don't fake shared 60 FPS. local deadline=os.clock()+5 driver.pose=previous driver.revision=driver.revision+1 driver.stop=true while not driver.done and os.clock()0 and root and (root.Position-center).Magnitude<=radius then hitNames[#hitNames+1]=plr.Name end end end local killed=0 for _,name in ipairs(hitNames) do local ok=submitHDAdminCommand(';kill '..name) if ok then killed=killed+1 end task.wait(.08) end return killed,hitNames end local function damageBuildingsNearImpact(ep,center,radius) local tracked={} for _,part in ipairs(registry.parts) do tracked[part]=true end local removeList,unanchorList={},{} local countSeen=0 for _,inst in ipairs(workspace:GetDescendants()) do if inst:IsA('BasePart') and inst.Anchored and not tracked[inst] and not inst:IsA('SpawnLocation') then local model=inst:FindFirstAncestorOfClass('Model') local hum=(model and model:FindFirstChildOfClass('Humanoid')) or nil if not hum then local dist=(inst.Position-center).Magnitude if dist<=radius then countSeen=countSeen+1 local inner=dist<=radius*0.48 local selector=(countSeen*13 + math.floor(inst.Size.Magnitude*10)) % 9 if inner and selector<=4 then removeList[#removeList+1]=inst elseif selector<=5 then unanchorList[#unanchorList+1]={Part=inst,Anchored=false} end end end end end local removed,unanchored=0,0 for i=1,#unanchorList,10 do local batch={} for j=i,math.min(i+9,#unanchorList) do batch[#batch+1]=unanchorList[j] end invoke(ep,'SyncAnchor',batch) unanchored=unanchored+#batch task.wait(math.max(.08,config.f3xDelay)) end for i=1,#removeList,10 do local batch={} for j=i,math.min(i+9,#removeList) do batch[#batch+1]=removeList[j] end invoke(ep,'Remove',batch) removed=removed+#batch task.wait(math.max(.08,config.f3xDelay)) end return removed,unanchored,#removeList+#unanchorList end runCataclysmEvent=function() if config.eventEmergencyActive then return false,'Emergency event cleanup in progress.' end if registry.busy or busy or realmBusy then return false,'An F3X job is already running' end if os.clock()-lastStart<12 then return false,'Cataclysm cooldown active' end if #registry.parts>0 then for _,p in ipairs(registry.parts) do if validRealmPart(p) then return false,'Use REMOVE CATACLYSM first to clear the previous impact' end end registry.parts={} end registry.busy=true registry.cancel=false local ok,result=pcall(function() report('Starting staff event...',true) local ep,root,char=getCharacterAndTools() checkActive() local forward=root.CFrame.LookVector forward=Vector3.new(forward.X,0,forward.Z) if forward.Magnitude<.01 then forward=Vector3.new(0,0,-1) end forward=forward.Unit local impactXZ=root.Position+forward*135 local params=RaycastParams.new() params.FilterType=Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances={char} params.IgnoreWater=true local groundHit=workspace:Raycast(impactXZ+Vector3.new(0,180,0),Vector3.new(0,-600,0),params) local impactPosition=Vector3.new(impactXZ.X,groundHit and groundHit.Position.Y or root.Position.Y-18,impactXZ.Z) local impactFrame=CFrame.lookAt(impactPosition,impactPosition+forward) -- PRELOAD PHASE: first build and FULLY style the giant crater at a -- remote altitude. All parts are anchored and tracked, and the -- animation cannot start until createBlueprint has returned. -- This is only a staging location, not an extra remote or server script. local ruins=wastelandSpecs() local stagingFrame=impactFrame*CFrame.new(0,1200,0) report(('PREPARING RUINED TERRAIN: %d parts (animation starts when ready)...'):format(#ruins),true) local ruinedRecords=createBlueprint(ep,ruins,stagingFrame,'PREPARING RUINS') waitForPreparedTerrain(ruinedRecords) checkActive() local impactRecords=createBlueprint(ep,impactEffectSpecs(),stagingFrame,'PREPARING IMPACT FX') waitForPreparedTerrain(impactRecords) checkActive() report(('PRELOAD COMPLETE: %d crater parts + %d impact FX pieces ready. Preparing staff...') :format(#ruinedRecords,#impactRecords),true) -- STAFF PHASE: create the staff only after terrain preparation. -- The player can move while preloading; use their current facing -- for the cinematic when the staff is ready. local current=player.Character local r=current and current:FindFirstChild('HumanoidRootPart') or root local startFrame=r.CFrame*CFrame.new(12,25,14)*CFrame.Angles(math.rad(-8),0,math.rad(-28)) local staff=createBlueprint(ep,staffSpecs(),startFrame,'ROBLOX STAFF') lastStart=os.clock() checkActive() report('STAFF + TERRAIN READY. Beginning smooth cinematic...',true) local impactDone=false local impactError=nil registry.playSmoothStaff(ep,staff,r.CFrame,impactPosition,startFrame,function() startLocalImpactFlash(impactPosition) -- Server F3X reveal begins immediately after the visual strike; -- it runs independently of any last staff network updates. task.spawn(function() local ok,why=pcall(function() report('STAFF IMPACT! Revealing prebuilt shockwave + ruined map...',true) revealPreparedTerrain(ep,impactRecords,impactFrame) task.spawn(function() animateSharedImpact(ep,impactRecords,impactPosition) end) revealPreparedTerrain(ep,ruinedRecords,impactFrame) end) if not ok then impactError=tostring(why) end impactDone=true end) end) -- The crater has to finish its SyncMove batches before running -- player/building impact commands or reporting event completion. while not impactDone do checkActive() task.wait(.08) end if impactError then error('Prepared impact reveal failed: '..impactError,2) end checkActive() report('Shockwave expanding... eliminating players and damaging nearby builds.',true) local killRadius=430 local damageRadius=510 local killed,hitNames=killPlayersNearImpact(impactPosition,killRadius) local removed,unanchored,affected=damageBuildingsNearImpact(ep,impactPosition,damageRadius) checkActive() -- Keep the record table alive for tracked part cleanup. registry.impact=impactPosition registry.killRadius=killRadius registry.damageRadius=damageRadius report('CATACLYSM COMPLETE: '..#ruinedRecords..' ruined terrain pieces, ' ..killed..' players hit, '..removed..' parts removed, '..unanchored..' parts unanchored.',true) return 'Staff slammed. '..#ruinedRecords..' terrain pieces loaded. ' ..killed..' players within '..killRadius..' studs were targeted; ' ..affected..' nearby structure parts were damaged.' end) registry.clearSmoothStaff() -- always restore hidden F3X parts after success/error/cancel if not ok then registry.clearImpactVisual() end registry.busy=false if ok then return true,result end report('Event stopped: '..tostring(result):sub(1,180),false) return false,tostring(result) end local function begin() report('PLAY pressed. Checking character, HD Admin and F3X...',true) task.spawn(function() local ok,success,message=pcall(runCataclysmEvent) if not ok then report('UNEXPECTED ERROR: '..tostring(success),false) elseif not success then report('START FAILED: '..tostring(message),false) end end) end local function diagnose() local char=player.Character local hum=char and char:FindFirstChildOfClass('Humanoid') local _,endpoint,why=detectBuildTool() local hd=ReplicatedStorage:FindFirstChild('HDAdminHDClient') local signals=hd and hd:FindFirstChild('Signals') local hdRemote=signals and signals:FindFirstChild('RequestCommandSilent') local rig=(hum and hum.RigType.Name or 'NO CHARACTER') local f3x=endpoint and 'F3X READY' or ('NO F3X: '..tostring(why)) local hdStatus=(hdRemote and hdRemote:IsA('RemoteFunction')) and 'HD ADMIN FOUND' or 'HD ADMIN NOT DETECTED (chat fallback only)' report('DIAGNOSTICS | '..rig..' | '..f3x..' | '..hdStatus,endpoint~=nil) end local function cancel() if not registry.busy then return report('No Cataclysm operation is running.',false) end registry.cancel=true report('Stop requested. Already built pieces remain tracked and removable.',true) end local function cleanup() if registry.busy or registry.impactAnimating or busy or realmBusy then return report('Wait for the current F3X job / impact effect to finish before cleanup.',false) end registry.busy=true registry.cancel=false task.spawn(function() local ok,err=pcall(function() local ep=getEndpoint() registry.clearImpactVisual() report('Removing only Cataclysm staff and terrain...',true) removeTracked(ep) end) registry.busy=false report(ok and 'Cataclysm props and terrain removed.' or ('Removal failed: '..tostring(err):sub(1,130)),ok) end) end local function resetSize() if registry.busy then return report('Finish or stop the current event first.',false) end local ok,reason=submitHDAdminCommand(';size me 1') report(ok and 'Requested normal avatar size through HD Admin.' or ('Reset request failed: '..tostring(reason)),ok) end config.stopCataclysmEvent=function() registry.cancel=true registry.clearSmoothStaff() registry.clearImpactVisual() end config.cleanupCataclysmEvent=function() if registry.busy or registry.impactAnimating or busy or realmBusy then return false,'Another F3X job / impact effect is still running.' end if #registry.parts==0 then return true end registry.clearImpactVisual() registry.busy=true registry.cancel=false -- Only clear cancellation once the runner has exited. local ok,err=pcall(function() local ep=getEndpoint() removeTracked(ep) end) registry.busy=false report(ok and 'Emergency cleanup removed Cataclysm-owned parts.' or ('Cataclysm cleanup incomplete: '..tostring(err):sub(1,110)),ok) return ok,err end textButton(eventPage,'▶ PLAY STAFF CATACLYSM',16,619,378,43,begin) textButton(eventPage,'■ STOP EVENT',409,619,386,43,cancel) textButton(eventPage,'REMOVE STAFF + RUINS (F3X)',16,678,378,43,cleanup) textButton(eventPage,'RESET MY SIZE',409,678,386,43,resetSize) textButton(eventPage,'CHECK EVENT REQUIREMENTS',16,740,779,42,diagnose) label(eventPage,'If nothing appears, click CHECK EVENT REQUIREMENTS and read the status line. ' ..'To build server-visible props you need an F3X tool with a working CreatePart SyncAPI. ' ..'HD Admin size is optional; if unavailable, the giant staff still runs. ' ..'Crater and impact FX must both finish creating and styling off-map before the staff starts moving. ' ..'At impact, prepared ruins move into place using F3X. Other players may see brief staggered movement. ' ..'To replay after a partial failure, use REMOVE STAFF + RUINS first.', 16,800,781,115,13,QUIET) end)() -- EVENT HORIZON / BLACK HOLE. -- F3X creates a shared physical singularity, accretion rings and debris. -- The existing Pixel Sky 1 / 2 image and any local Lighting.Sky are preserved. -- A temporary local color filter plus optional reversible F3X dome tint create -- the eclipse effect without replacing any Skybox texture IDs. -- Only parts created by THIS event are moved, collapsed and removed. -- Isolated function scope also avoids Lua's 200-active-locals limit in a large GUI. ;(function() local M=Enum.Material local colors={ void=Color3.fromRGB(7,5,16), rim=Color3.fromRGB(155,67,246), violet=Color3.fromRGB(103,42,185), blue=Color3.fromRGB(70,118,255), pale=Color3.fromRGB(222,167,255), rock=Color3.fromRGB(43,39,59), slate=Color3.fromRGB(80,72,103), ember=Color3.fromRGB(233,95,224), deep=Color3.fromRGB(26,24,40), cracked=Color3.fromRGB(59,51,76), } local registry=env.__PixelGUI_BlackHoleEvent if type(registry)~='table' or registry.sessionKey~=mapSessionKey then registry={sessionKey=mapSessionKey,parts={},busy=false,cancel=false,serial=0} env.__PixelGUI_BlackHoleEvent=registry end if type(registry.parts)~='table' then registry.parts={} end -- If the GUI gets reexecuted, clean up its previous client animation, -- camera takeover, and locally hidden shared F3X parts first. if type(registry.clearVisuals)=='function' then pcall(registry.clearVisuals) end if registry.filter and registry.filter.Parent then pcall(function() registry.filter:Destroy() end) end registry.filter=nil registry.serial=(tonumber(registry.serial) or 0)+1 registry.busy=false registry.cancel=false local serial=registry.serial local lastRun=-1000 local skyReactive=true local apocalypse=false local cameraCinematic=true local y=990 label(eventPage,'EVENT HORIZON | BLACK HOLE',16,y,785,29,18,GOLD) label(eventPage, 'Preloads the black hole and crater first, then eclipses your Pixel Sky and plays the smooth singularity, implosion and instant prebuilt-crater reveal.', 16,y+34,770,53,13,WHITE) local status=label(eventPage,'READY | Select options, then play.',16,y+91,778,46,13,GREEN) local skyButton,scaleButton,cameraButton local function report(msg,ok) if gui.Parent and status.Parent then status.Text=tostring(msg):sub(1,230) status.TextColor3=(ok==false) and AMBER or GREEN if ok==false then warn('[Pixel GUI / Event Horizon] '..tostring(msg)) end say('Event Horizon: '..tostring(msg):sub(1,135),ok~=false) end end local function check() if not gui.Parent or registry.serial~=serial or registry.cancel then error('Black Hole stopped. Existing F3X pieces remain available for cleanup.',2) end end local function rpc(ep,action,argument) check() local ok,response=pcall(function() return ep:InvokeServer(action,argument) end) if not ok then error('F3X '..action..' failed: '..tostring(response),2) end if response==false then error('F3X denied '..action,2) end return response end local function getEndpoint() local _,ep,reason=detectBuildTool() if not ep then error('Equip F3X Building Tools first. '..tostring(reason),2) end return ep end local function waitStep(duration) local elapsed=0 while elapsed=10 or i==#specs then styleBatch(ep,chunk) chunk={} end if i==1 or i%10==0 or i==#specs then local elapsed=os.clock()-lastTime local eta=elapsed/math.max(i,1)*(#specs-i) report(('%s: %d/%d parts | ~%ds'):format(caption,i,#specs,math.ceil(eta)),true) end if i<#specs then waitStep(math.max(.18,config.realmPartDelay)) end if i%40==0 then waitStep(1.2) end end return records end -- Stage ALL server-visible cinematic scenery before beginning the eclipse. -- Store target CFrames so the impact reveal uses SyncMove, not CreatePart. local function stageBlueprint(specs,offset) for _,r in ipairs(specs) do r.targetCF=r.cf r.cf=r.cf+offset end return specs end local function waitForReady(records,caption) local deadline=os.clock()+14 local previous=-1 repeat check() local ready=0 for _,r in ipairs(records) do if validRealmPart(r.part) and r.part.Anchored and (r.part.Size-r.size).Magnitude<.6 then ready=ready+1 end end if ready==#records then report(caption..' ready: '..ready..'/'..#records..' staged parts.',true) return end if ready~=previous then report(caption..' waiting for replication: '..ready..'/'..#records,true) previous=ready end if os.clock()>=deadline then error(caption..': only '..ready..'/'..#records..' pieces confirmed. Animation NOT started.',2) end waitStep(.3) until false end local function revealPrebuilt(ep,records,caption) local moved=0 for first=1,#records,16 do check() local changes={} for i=first,math.min(first+15,#records) do local r=records[i] if not r.targetCF or not validRealmPart(r.part) then error(caption..' part '..i..' vanished before reveal.',2) end changes[#changes+1]={Part=r.part,CFrame=r.targetCF} end rpc(ep,'SyncMove',changes) for i=first,math.min(first+15,#records) do records[i].cf=records[i].targetCF end moved=moved+#changes if moved==#records or moved%32==0 then report(caption..' reveal: '..moved..'/'..#records,true) end if moved<#records then waitStep(math.max(.08,config.f3xDelay)) end end return moved end local function ringCFrame(center,layer,index,count,radius,phase,ground) local a=(index-1)*math.pi*2/count+phase local xAngle=layer==1 and 24 or (layer==2 and -28 or 11) local zAngle=layer==1 and 12 or (layer==2 and -16 or 4) local tilt=ground and CFrame.new(center) or (CFrame.new(center)*CFrame.Angles(math.rad(xAngle),0,math.rad(zAngle))) -- +90 deg means the long edge of each segment runs along the ring, -- instead of pointing radially like a series of disconnected spikes. return tilt*CFrame.new(math.cos(a)*radius,0,math.sin(a)*radius)* CFrame.Angles(0,-a+math.pi*.5,0) end -- Forward declaration: the F3X proxy animation is defined below. local animate -- Client-side cinematic renderer: smooth every RenderStepped frame. -- The server-visible F3X proxy is independently updated at a lower rate; -- this renderer uses ordinary local Parts only, no extra remotes. local RunService=game:GetService('RunService') local function clearVisuals(keepProxyHidden) local v=registry.visuals registry.visuals=nil if v then v.dead=true if v.driver then v.driver.stop=true end if v.connection then pcall(function() v.connection:Disconnect() end) end if v.model then pcall(function() v.model:Destroy() end) end local snapshot=v.cameraSaved local cam=workspace.CurrentCamera if snapshot and cam then pcall(function() cam.CameraType=snapshot.type if snapshot.subject then cam.CameraSubject=snapshot.subject end cam.FieldOfView=snapshot.fov if snapshot.type==Enum.CameraType.Scriptable then cam.CFrame=snapshot.cf end end) end end if not keepProxyHidden then if registry.hiddenParts then for part,transparency in pairs(registry.hiddenParts) do if part and part.Parent then pcall(function() part.LocalTransparencyModifier=transparency end) end end end registry.hiddenParts=nil end end registry.clearVisuals=clearVisuals gui.Destroying:Connect(function() clearVisuals() end) local function hideSharedProxy(records) registry.hiddenParts=registry.hiddenParts or {} for _,record in ipairs(records) do local part=record.part if part and part.Parent then registry.hiddenParts[part]=part.LocalTransparencyModifier pcall(function() part.LocalTransparencyModifier=1 end) end end end local function makeVisuals(center,impact,blastScale) clearVisuals() local folder=Instance.new('Model') folder.Name='PixelGUI_EventHorizon_Cinematic' folder.Parent=workspace local function newPart(name,shape,size,col,material,transparency) local p=Instance.new('Part') p.Name=name p.Anchored=true p.CanCollide=false p.CanTouch=false p.CanQuery=false p.CastShadow=false p.Material=material p.Color=col p.Size=size p.Transparency=transparency or 0 if shape=='Ball' then p.Shape=Enum.PartType.Ball end p.CFrame=CFrame.new(center) p.Parent=folder return p end -- Opaque inner sphere plus two luminous shells form an obvious black -- circular silhouette even against the dark Pixel Sky eclipse. local halo2=newPart('Outer_Violet_Lensing','Ball',Vector3.new(115,115,115), colors.blue,M.Neon,.77) local halo1=newPart('Bright_Event_Horizon','Ball',Vector3.new(104,104,104), colors.rim,M.Neon,.46) local core=newPart('VISIBLE_BLACK_HOLE_CORE','Ball',Vector3.new(91,91,91), Color3.fromRGB(1,1,3),M.SmoothPlastic,0) local light=Instance.new('PointLight') light.Brightness=1.6 light.Range=180 light.Color=colors.rim light.Parent=halo1 local rings={} for layer=1,3 do local count=layer==1 and 20 or (layer==2 and 16 or 12) for i=1,count do local col=(layer==1) and colors.rim or ((layer==2) and colors.blue or colors.pale) local piece=newPart('Accretion_'..layer..'_'..i,nil, Vector3.new(29,layer==1 and 8 or 5,layer==1 and 18 or 12), col,M.Neon,layer==3 and .24 or .07) rings[#rings+1]={part=piece,layer=layer,index=i,count=count} end end local debris={} for i=1,16 do local p=newPart('Orbital_Debris_'..i,nil,Vector3.new(12+i%4*3,12+i%3*4,11+i%5*2), i%3==0 and colors.slate or colors.rock,M.Rock,0) debris[#debris+1]=p end local v={model=folder,core=core,halo1=halo1,halo2=halo2,rings=rings, debris=debris,center=center,impact=impact,scale=blastScale, stage='forming',progress=0,dead=false,clock=0} registry.visuals=v local cam=workspace.CurrentCamera if cameraCinematic and cam then v.cameraSaved={type=cam.CameraType,subject=cam.CameraSubject, cf=cam.CFrame,fov=cam.FieldOfView} cam.CameraType=Enum.CameraType.Scriptable end v.connection=RunService.RenderStepped:Connect(function(dt) if v.dead or registry.serial~=serial or not gui.Parent then return end dt=math.min(dt,.07) v.clock=v.clock+dt local t=v.clock local eased=v.progress*v.progress*(3-2*v.progress) local grow if v.stage=='forming' then grow=.30+.08*math.sin(t*.85) elseif v.stage=='growth' then grow=.29+.71*eased elseif v.stage=='collapse' then grow=math.max(.015,1-v.progress*v.progress) elseif v.stage=='shockwave' then grow=.012 else grow=.02 end local diameter=83+140*grow if v.stage=='shockwave' then diameter=math.max(1,diameter*(1-v.progress)) end local orbSize=Vector3.new(diameter,diameter,diameter) core.Size=orbSize core.CFrame=CFrame.new(center) halo1.Size=orbSize+Vector3.new(26,26,26) halo1.CFrame=core.CFrame halo2.Size=orbSize+Vector3.new(70,70,70) halo2.CFrame=core.CFrame halo1.Transparency=v.stage=='shockwave' and math.min(1,.46+v.progress*.6) or .42 halo2.Transparency=v.stage=='shockwave' and math.min(1,.77+v.progress*.3) or .72 core.Transparency=v.stage=='shockwave' and math.min(1,v.progress*5) or 0 local speed=t*(.65+grow*1.15) local isShock=v.stage=='shockwave' for _,ring in ipairs(rings) do local base=ring.layer==1 and 115 or (ring.layer==2 and 165 or 212) local radius=isShock and (65+v.progress*680*v.scale) or (base*(.64+grow*.70)) local spin=speed*(ring.layer==1 and 1.35 or (ring.layer==2 and -.92 or .51)) local position=isShock and impact+Vector3.new(0,11+ring.layer*2,0) or center ring.part.CFrame=ringCFrame(position,ring.layer,ring.index,ring.count, radius,spin,isShock) ring.part.Transparency=isShock and (.12+.83*v.progress) or (ring.layer==3 and .25 or .03) end for i,p in ipairs(debris) do local a=t*(.31+(i%5)*.085)+i*math.pi*2/16 local radius=isShock and (120+v.progress*(520+(i%3)*55))*v.scale or (205+(i%5)*18)*(1.22-.40*grow) local y=isShock and (8+(i%6)*7) or (-85+(i%7)*23+58*grow+math.sin(t*1.3+i)*19) local origin=isShock and impact or center p.CFrame=CFrame.new(origin+Vector3.new(math.cos(a)*radius,y, math.sin(a)*radius))*CFrame.Angles(t*.7+i*.11,t*.43+i*.2,t*.35) p.Transparency=isShock and math.clamp(v.progress*.75,0,.75) or 0 end -- Opt-in cinematic framing guarantees the sphere is on screen. if v.cameraSaved then local camera=workspace.CurrentCamera if camera then local orbit=t*.115 local desiredPosition=center+Vector3.new(math.cos(orbit)*315, 40+math.sin(t*.30)*23,math.sin(orbit)*315) if isShock then desiredPosition=impact+Vector3.new(math.cos(orbit)*450, 230,math.sin(orbit)*450) end local lookAt=isShock and impact or center local desired=CFrame.lookAt(desiredPosition,lookAt) camera.CFrame=camera.CFrame:Lerp(desired,1-math.exp(-dt*3.2)) camera.FieldOfView=68 end end end) return v end local function playVisualPhase(v,stage,duration) v.stage=stage local began=os.clock() while true do check() v.progress=math.clamp((os.clock()-began)/duration,0,1) if v.progress>=1 then break end RunService.Heartbeat:Wait() end v.progress=1 end -- Single writer to F3X: never queue a full animation's worth of requests. -- Other clients can only see the rate their F3X server permits, not 60 FPS. local function startProxyDriver(ep,records,center,impact,blastScale,v) local driver={stop=false,done=false,failed=nil} v.driver=driver task.spawn(function() while not driver.stop and not registry.cancel and gui.Parent and registry.serial==serial do local stage=v.stage if stage=='growth' or stage=='collapse' or stage=='shockwave' then local phase=stage=='shockwave' and 'shockwave' or 'orbit' local scale=stage=='growth' and (.29+.71*v.progress) or (stage=='collapse' and (1-v.progress*v.progress) or v.progress) local angle=v.clock*.82 local ok,err=pcall(animate,ep,records,center,scale,angle,phase,impact,blastScale) if not ok then driver.failed=tostring(err) break end end task.wait(.33) end driver.done=true end) return driver end local function constructSingularity(center) local specs={} specs[#specs+1]=partSpec('core',CFrame.new(center),Vector3.new(84,84,84), Color3.fromRGB(2,1,5),M.SmoothPlastic,false,{role='core'}) for layer=1,2 do local count=layer==1 and 16 or 12 for i=1,count do local cf=ringCFrame(center,layer,i,count,layer==1 and 74 or 101,0,false) local col=(layer==1 and colors.rim or colors.blue) specs[#specs+1]=partSpec('ring',cf, Vector3.new(layer==1 and 29 or 37,5,10),col,M.Neon,false, {role='ring',layer=layer,index=i,count=count}) end end for i=1,14 do local a=i*2*math.pi/14 local r=160+(i%4)*31 local cf=CFrame.new(center+Vector3.new(math.cos(a)*r,-125+(i%4)*10,math.sin(a)*r)) *CFrame.Angles(i*.2,i*.39,i*.11) specs[#specs+1]=partSpec('debris',cf, Vector3.new(11+(i%3)*5,12+(i%4)*8,13+(i%3)*4), (i%3==0) and colors.slate or colors.rock,M.Rock,false, {role='debris',index=i}) end return specs end animate=function(ep,records,center,scale,angle,phase,impact,blastScale) local move,resize={},{ } local ringTotal=0 for _,r in ipairs(records) do if not validRealmPart(r.part) then error('Black Hole part missing during '..phase..'.',2) end local info=r.extra if info.role=='core' then local dim=(phase=='shockwave') and 8 or (84+138*scale) resize[#resize+1]={Part=r.part,CFrame=CFrame.new(center),Size=Vector3.new(dim,dim,dim)} elseif info.role=='ring' then local radius,cf if phase=='shockwave' then radius=(85+330*scale)*blastScale cf=ringCFrame(impact+Vector3.new(0,10+info.layer*3,0),info.layer, info.index,info.count,radius,angle*0.15,true) else radius=(info.layer==1 and 74 or 101)*(0.6+1.1*scale) cf=ringCFrame(center,info.layer,info.index,info.count,radius, angle*(info.layer==1 and 1 or -0.8),false) end move[#move+1]={Part=r.part,CFrame=cf} ringTotal=ringTotal+1 elseif info.role=='debris' then local a=info.index*math.pi*2/14+angle local dist=(phase=='shockwave') and (210+info.index%4*28)*blastScale or (160+info.index%4*31)*(1.5-0.65*scale) local yy=(phase=='shockwave') and (12+info.index%5*6) or (-125+info.index%4*10+scale*95) local position=(phase=='shockwave') and impact or center move[#move+1]={Part=r.part,CFrame=CFrame.new(position+ Vector3.new(math.cos(a)*dist,yy,math.sin(a)*dist)) *CFrame.Angles(angle*1.2,angle+info.index*.2,angle*.6)} end end if #resize>0 then rpc(ep,'SyncResize',resize) end for i=1,#move,12 do local chunk={} for j=i,math.min(#move,i+11) do chunk[#chunk+1]=move[j] end rpc(ep,'SyncMove',chunk) waitStep(math.max(.08,config.f3xDelay)) end end local function craterBlueprint(impact,scale) local specs={} local function put(cf,size,col,mat,collide) specs[#specs+1]=partSpec('terrain',cf,size,col,mat,collide) end -- Up to ~1,350 studs wide in Apocalypse mode. No Terrain deletion. local width=870*scale put(CFrame.new(impact+Vector3.new(0,-4,0)), Vector3.new(width,8,width),colors.deep,M.Basalt,true) for x=-2,2 do for z=-2,2 do if math.max(math.abs(x),math.abs(z))>0 then local side=162*scale local offset=Vector3.new(x*169*scale,1+(math.abs(x+z)%3)*2,z*169*scale) put(CFrame.new(impact+offset)*CFrame.Angles(0,math.rad((x*13+z*27)%17-8),0), Vector3.new(side,5+math.abs(x-z)%3,side), ((x+z)%2==0) and colors.cracked or colors.rock,M.Slate,true) end end end put(CFrame.new(impact+Vector3.new(0,3,0)), Vector3.new(235*scale,3,235*scale),colors.void,M.Basalt,true) for i=1,20 do local a=i*math.pi/10 local rad=(130+(i%3)*16)*scale put(CFrame.new(impact+Vector3.new(math.cos(a)*rad,10+(i%4)*4,math.sin(a)*rad)) *CFrame.Angles(math.rad((i%5-2)*7),-a,math.rad((i%3-1)*5)), Vector3.new(25*scale,20+(i%5)*7,18*scale), (i%3==0) and colors.slate or colors.rock,M.Rock,true) end for i=1,18 do local a=i*math.pi/9 local rad=(240+(i%5)*42)*scale put(CFrame.new(impact+Vector3.new(math.cos(a)*rad,4,math.sin(a)*rad)) *CFrame.Angles(0,a,0),Vector3.new(3,.6,85*scale), (i%3==0) and colors.blue or colors.rim,M.Neon,false) end return specs end local function removeParts(ep,subset) local batch={} local count=0 for _,p in ipairs(subset) do local part=p.part or p if validRealmPart(part) then batch[#batch+1]=part if #batch>=10 then rpc(ep,'Remove',batch) count=count+#batch batch={} waitStep(math.max(.1,config.f3xDelay)) end end end if #batch>0 then rpc(ep,'Remove',batch) count=count+#batch end return count end local function execute() if config.eventEmergencyActive then return false,'Emergency event cleanup in progress.' end if registry.busy or busy or realmBusy then return false,'Another F3X operation is in progress.' end if os.clock()-lastRun<10 then return false,'Black Hole cooldown active.' end for _,p in ipairs(registry.parts) do if validRealmPart(p) then return false,'Use REMOVE BLACK HOLE / CRATER before starting another event.' end end registry.parts={} registry.busy=true registry.cancel=false realmBusy=true local endpoint local ok,result=pcall(function() report('Preparing the eclipse and detecting F3X...',true) local ep=getEndpoint() endpoint=ep local character=player.Character local hum=character and character:FindFirstChildOfClass('Humanoid') local rootPart=character and character:FindFirstChild('HumanoidRootPart') if not rootPart or not hum or hum.Health<=0 then error('Respawn before starting Black Hole.',2) end local face=rootPart.CFrame.LookVector face=Vector3.new(face.X,0,face.Z) if face.Magnitude<.01 then face=Vector3.new(0,0,-1) end face=face.Unit local target=rootPart.Position+face*215 local rayParams=RaycastParams.new() rayParams.FilterType=Enum.RaycastFilterType.Exclude rayParams.FilterDescendantsInstances={character} local hit=workspace:Raycast(target+Vector3.new(0,220,0),Vector3.new(0,-620,0),rayParams) local impact=Vector3.new(target.X,hit and hit.Position.Y or rootPart.Position.Y-16,target.Z) local center=impact+Vector3.new(0,165,0) local blastScale=apocalypse and 1.55 or 1 -- Prebuild the singularity AND crater away from the play area. -- Do not darken the sky or start local animation until both have -- finished CreatePart, styling, and replication checks. local singularityStage=Vector3.new(0,1200,0) local craterStage=Vector3.new(0,1200,0) report('PRELOAD: constructing the Black Hole off-map...',true) local singularity=build(ep,stageBlueprint(constructSingularity(center),singularityStage),'PREPARING SINGULARITY') waitForReady(singularity,'SINGULARITY') report('PRELOAD: constructing the crater before the eclipse...',true) local crater=build(ep,stageBlueprint(craterBlueprint(impact,blastScale),craterStage),'PREPARING VOID CRATER') waitForReady(crater,'VOID CRATER') check() report('PRELOAD COMPLETE: singularity + all '..#crater..' crater pieces ready.',true) lastRun=os.clock() -- Bring the already-styled singularity overhead before animating. -- The crater remains staged until the implosion. revealPrebuilt(ep,singularity,'SINGULARITY') if skyReactive then saveFilter() tintDome(ep) end report('ECLIPSE: the visible black sphere is forming. Smooth cinematic active.',true) local visuals=makeVisuals(center,impact,blastScale) hideSharedProxy(singularity) local driver=startProxyDriver(ep,singularity,center,impact,blastScale,visuals) report('GRAVITY WELL: smooth growth, rotating disk and orbital debris...',true) playVisualPhase(visuals,'growth',6.0) report('CRITICAL MASS: the visible sphere is collapsing!',true) playVisualPhase(visuals,'collapse',3.1) report('IMPLOSION! The shockwave triggers the prebuilt crater reveal.',true) -- Local shockwave continues smoothly while F3X reveals the staged -- crater. It is NEVER constructed after the cinematic starts. local shockDone=false local shockProblem=nil task.spawn(function() local ok,why=pcall(playVisualPhase,visuals,'shockwave',2.0) if not ok then shockProblem=tostring(why) end shockDone=true end) revealPrebuilt(ep,crater,'VOID CRATER') while not shockDone do check();task.wait(.05) end if shockProblem then error('Shockwave visual: '..shockProblem,2) end driver.stop=true local deadline=os.clock()+4 while not driver.done and os.clock()