-- [[ ONIX PLAYER VIEWER ]] -- local Players = game:GetService("Players") local lp = Players.LocalPlayer local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Camera = workspace.CurrentCamera local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "OnixPlayerViewer" ScreenGui.Parent = game.CoreGui ScreenGui.ResetOnSpawn = false -- [[ DRAGGING LOGIC ]] -- local function makeDraggable(frame) local dragging, dragInput, dragStart, startPos frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) frame.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then local delta = input.Position - dragStart frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) end -- [[ MAIN UI ]] -- local Main = Instance.new("Frame") Main.Size = UDim2.new(0, 200, 0, 260) Main.Position = UDim2.new(0.8, 0, 0.5, -130) Main.BackgroundColor3 = Color3.fromRGB(0, 0, 0) Main.Parent = ScreenGui local MainStroke = Instance.new("UIStroke", Main) MainStroke.Thickness = 2 Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 15) makeDraggable(Main) -- Rainbow Outline task.spawn(function() while task.wait() do MainStroke.Color = Color3.fromHSV(tick() % 5 / 5, 0.8, 1) end end) -- Header local Title = Instance.new("TextLabel") Title.Size = UDim2.new(1, -70, 0, 30) Title.Position = UDim2.new(0, 10, 0, 0) Title.BackgroundTransparency = 1 Title.Text = "Onix Viewer" Title.TextColor3 = Color3.new(1, 1, 1) Title.TextXAlignment = Enum.TextXAlignment.Left Title.Font = Enum.Font.GothamBold Title.TextSize = 13 Title.Parent = Main -- Controls local MinBtn = Instance.new("TextButton") MinBtn.Size = UDim2.new(0, 25, 0, 25) MinBtn.Position = UDim2.new(1, -55, 0, 3) MinBtn.Text = "-" MinBtn.BackgroundColor3 = Color3.fromRGB(20, 20, 20) MinBtn.TextColor3 = Color3.new(1, 1, 1) MinBtn.Parent = Main Instance.new("UICorner", MinBtn) local CloseBtn = Instance.new("TextButton") CloseBtn.Size = UDim2.new(0, 25, 0, 25) CloseBtn.Position = UDim2.new(1, -28, 0, 3) CloseBtn.Text = "X" CloseBtn.BackgroundColor3 = Color3.fromRGB(150, 0, 0) CloseBtn.TextColor3 = Color3.new(1, 1, 1) CloseBtn.Parent = Main Instance.new("UICorner", CloseBtn) -- Avatar Display local ViewContainer = Instance.new("Frame") ViewContainer.Size = UDim2.new(0.85, 0, 0.55, 0) ViewContainer.Position = UDim2.new(0.075, 0, 0.15, 0) ViewContainer.BackgroundColor3 = Color3.fromRGB(10, 10, 10) ViewContainer.Parent = Main Instance.new("UICorner", ViewContainer) local Viewport = Instance.new("ViewportFrame") Viewport.Size = UDim2.new(1, 0, 1, 0) Viewport.BackgroundTransparency = 1 Viewport.Parent = ViewContainer local vCam = Instance.new("Camera") Viewport.CurrentCamera = vCam vCam.Parent = Viewport local NameLabel = Instance.new("TextLabel") NameLabel.Size = UDim2.new(1, 0, 0, 20) NameLabel.Position = UDim2.new(0, 0, 0.72, 0) NameLabel.BackgroundTransparency = 1 NameLabel.Text = "None" NameLabel.TextColor3 = Color3.new(1, 1, 1) NameLabel.Font = Enum.Font.GothamSemibold NameLabel.TextSize = 11 NameLabel.Parent = Main -- Cycle Controls local PrevBtn = Instance.new("TextButton") PrevBtn.Size = UDim2.new(0, 35, 0, 30) PrevBtn.Position = UDim2.new(0.05, 0, 0.85, 0) PrevBtn.Text = "<" PrevBtn.BackgroundColor3 = Color3.fromRGB(25, 25, 25) PrevBtn.TextColor3 = Color3.new(1, 1, 1) PrevBtn.Parent = Main Instance.new("UICorner", PrevBtn) local UnviewBtn = Instance.new("TextButton") UnviewBtn.Size = UDim2.new(0, 90, 0, 30) UnviewBtn.Position = UDim2.new(0.27, 0, 0.85, 0) UnviewBtn.Text = "UNVIEW" UnviewBtn.BackgroundColor3 = Color3.fromRGB(35, 35, 35) UnviewBtn.TextColor3 = Color3.new(1, 1, 1) UnviewBtn.Font = Enum.Font.GothamBold UnviewBtn.TextSize = 10 UnviewBtn.Parent = Main Instance.new("UICorner", UnviewBtn) local NextBtn = Instance.new("TextButton") NextBtn.Size = UDim2.new(0, 35, 0, 30) NextBtn.Position = UDim2.new(0.77, 0, 0.85, 0) NextBtn.Text = ">" NextBtn.BackgroundColor3 = Color3.fromRGB(25, 25, 25) NextBtn.TextColor3 = Color3.new(1, 1, 1) NextBtn.Parent = Main Instance.new("UICorner", NextBtn) -- [[ SPECTATE LOGIC ]] -- local currentIndex = 1 local isSpectating = false local currentTarget = nil local function resetCamera() isSpectating = false currentTarget = nil if lp.Character and lp.Character:FindFirstChildOfClass("Humanoid") then Camera.CameraSubject = lp.Character:FindFirstChildOfClass("Humanoid") end end local function updateSpectate() local allPlayers = Players:GetPlayers() if #allPlayers <= 1 then resetCamera() NameLabel.Text = "No Players Found" return end if currentIndex > #allPlayers then currentIndex = 1 end if currentIndex < 1 then currentIndex = #allPlayers end local target = allPlayers[currentIndex] if target == lp then currentIndex = currentIndex + 1 updateSpectate() return end if target then isSpectating = true currentTarget = target NameLabel.Text = target.DisplayName -- UI Viewport for _, v in pairs(Viewport:GetChildren()) do if v:IsA("Model") then v:Destroy() end end if target.Character then target.Character.Archivable = true local clone = target.Character:Clone() clone.Parent = Viewport local hrp = clone:FindFirstChild("HumanoidRootPart") if hrp then vCam.CFrame = CFrame.new(hrp.Position + hrp.CFrame.LookVector * 5, hrp.Position) end end end end -- Force Camera Subject Loop RunService.RenderStepped:Connect(function() if isSpectating and currentTarget and currentTarget.Parent then local char = currentTarget.Character local hum = char and char:FindFirstChildOfClass("Humanoid") if hum and Camera.CameraSubject ~= hum then Camera.CameraSubject = hum end elseif isSpectating and (not currentTarget or not currentTarget.Parent) then resetCamera() end end) NextBtn.MouseButton1Click:Connect(function() currentIndex = currentIndex + 1 updateSpectate() end) PrevBtn.MouseButton1Click:Connect(function() currentIndex = currentIndex - 1 updateSpectate() end) UnviewBtn.MouseButton1Click:Connect(resetCamera) -- Minimize/Close local minimized = false MinBtn.MouseButton1Click:Connect(function() minimized = not minimized Main.Size = minimized and UDim2.new(0, 200, 0, 35) or UDim2.new(0, 200, 0, 260) ViewContainer.Visible = not minimized NameLabel.Visible = not minimized PrevBtn.Visible = not minimized NextBtn.Visible = not minimized UnviewBtn.Visible = not minimized end) CloseBtn.MouseButton1Click:Connect(function() resetCamera() ScreenGui:Destroy() end) updateSpectate()