-- Admin Dashboard Framework -- Designed for optimized UI layout and standard player tracking local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ContextActionService = game:GetService("ContextActionService") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera -- 1. UI Setup Configuration local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AdminDashboard" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") -- Main Container Panel local MainPanel = Instance.new("Frame") MainPanel.Size = UDim2.new(0, 240, 0, 300) MainPanel.Position = UDim2.new(0, 15, 0, 15) MainPanel.BackgroundColor3 = Color3.fromRGB(20, 20, 20) MainPanel.BorderSizePixel = 1 MainPanel.BorderColor3 = Color3.fromRGB(60, 60, 60) MainPanel.Parent = ScreenGui -- Header Title local HeaderLabel = Instance.new("TextLabel") HeaderLabel.Size = UDim2.new(1, 0, 0, 35) HeaderLabel.BackgroundColor3 = Color3.fromRGB(30, 30, 30) HeaderLabel.Text = "DEVELOPER TOOLS" HeaderLabel.TextColor3 = Color3.fromRGB(240, 240, 240) HeaderLabel.Font = Enum.Font.SourceSansBold HeaderLabel.TextSize = 14 HeaderLabel.Parent = MainPanel -- Toggle List Container local ListLayout = Instance.new("UIListLayout") ListLayout.Padding = UDim.new(0, 5) ListLayout.SortOrder = Enum.SortOrder.LayoutOrder local ButtonContainer = Instance.new("Frame") ButtonContainer.Size = UDim2.new(1, -20, 1, -50) ButtonContainer.Position = UDim2.new(0, 10, 0, 45) ButtonContainer.BackgroundTransparency = 1 ButtonContainer.Parent = MainPanel ListLayout.Parent = ButtonContainer -- 2. State & Tracking Cache local SystemStates = { TrackingActive = false, ControlOverride = false } local UIReferences = {} local TrackerPool = {} -- 3. Optimized Object Pooling for Position Indicators local function getOrCreateTracker(player) if TrackerPool[player] then return TrackerPool[player] end local indicator = Instance.new("Frame") local innerDot = Instance.new("Frame") indicator.Size = UDim2.new(0, 8, 0, 8) indicator.AnchorPoint = Vector2.new(0, 0) indicator.BackgroundColor3 = Color3.fromRGB(0, 180, 255) indicator.BorderSizePixel = 0 indicator.Visible = false indicator.Parent = ScreenGui innerDot.Size = UDim2.new(0, 4, 0, 4) innerDot.Position = UDim2.new(0.5, -2, 0.5, -2) innerDot.BackgroundColor3 = Color3.fromRGB(255, 255, 255) innerDot.BorderSizePixel = 0 innerDot.Parent = indicator TrackerPool[player] = indicator return indicator end -- 4. Unified Render Update Loop RunService.RenderStepped:Connect(function() if not SystemStates.TrackingActive then -- Hide all trackers if system is inactive for _, tracker in pairs(TrackerPool) do tracker.Visible = false end return end for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local rootPart = player.Character:FindFirstChild("HumanoidRootPart") if rootPart then local screenPos, onScreen = Camera:WorldToViewportPoint(rootPart.Position) local tracker = getOrCreateTracker(player) if onScreen then -- Adjusting for anchor offset to keep aligned smoothly tracker.Position = UDim2.new(0, screenPos.X - 4, 0, screenPos.Y - 4) tracker.Visible = true else tracker.Visible = false end end end end end) -- Clean up when players leave the session Players.PlayerRemoving:Connect(function(player) if TrackerPool[player] then TrackerPool[player]:Destroy() TrackerPool[player] = nil end end) -- 5. Control Bindings (ContextActionService) local function executeMovement(actionName, inputState, inputObj) if not SystemStates.ControlOverride then return Enum.ContextActionResult.Pass end if inputState == Enum.UserInputState.Begin then print("Override movement step acknowledged for: " .. actionName) -- Normal character navigation or camera manipulation logic would update here safely end return Enum.ContextActionResult.Sink end -- 6. Helper Function to Build Interface Switches local function createToggle(name, default, callback) local button = Instance.new("TextButton") button.Size = UDim2.new(1, 0, 0, 32) button.BackgroundColor3 = default and Color3.fromRGB(0, 120, 200) or Color3.fromRGB(45, 45, 45) button.Text = name .. (default and ": ENABLED" or ": DISABLED") button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.SourceSans button.TextSize = 13 button.Parent = ButtonContainer local active = default button.MouseButton1Click:Connect(function() active = not active button.BackgroundColor3 = active and Color3.fromRGB(0, 120, 200) or Color3.fromRGB(45, 45, 45) button.Text = name .. (active and ": ENABLED" or ": DISABLED") callback(active) end) UIReferences[name] = button end -- 7. Initialize Control Hooks createToggle("Player Tracker", false, function(state) SystemStates.TrackingActive = state end) createToggle("Control Override", false, function(state) SystemStates.ControlOverride = state if state then ContextActionService:BindAction("AdminMoveForward", executeMovement, false, Enum.KeyCode.W) ContextActionService:BindAction("AdminMoveBackward", executeMovement, false, Enum.KeyCode.S) else ContextActionService:UnbindAction("AdminMoveForward") ContextActionService:UnbindAction("AdminMoveBackward") end end)