script spectator
Key RequiredUniversal

script spectator

Universal Scriptinf6inf6 843 views 2.4K executesUpdated Feb 17, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•243 lines (8546 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera

-- Variables
local following = false
local followConnection = nil
local index = 1
local currentTarget = nil
local listOpen = false

-- Create UI
local ScreenGui = Instance.new("ScreenGui")
local MainFrame = Instance.new("Frame")
local UICorner = Instance.new("UICorner")
local Title = Instance.new("TextLabel")
local NextBtn = Instance.new("TextButton")
local PrevBtn = Instance.new("TextButton")
local StopBtn = Instance.new("TextButton")
local FollowBtn = Instance.new("TextButton")
local ListBtn = Instance.new("TextButton")
local MinBtn = Instance.new("TextButton")
local TargetName = Instance.new("TextLabel")
local PlayerScroll = Instance.new("ScrollingFrame")
local ListLayout = Instance.new("UIListLayout")
local ListPadding = Instance.new("UIPadding")

-- Floating Button (Minimize Feature)
local OpenBtn = Instance.new("TextButton")
local OpenCorner = Instance.new("UICorner")

ScreenGui.Parent = game.CoreGui
MainFrame.Name = "SPECTATE_PLAYER_V5_INF6"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
MainFrame.Position = UDim2.new(0.5, -110, 0.5, -90)
MainFrame.Size = UDim2.new(0, 220, 0, 185)
MainFrame.Active = true
MainFrame.Draggable = true

UICorner.CornerRadius = UDim.new(0, 10)
UICorner.Parent = MainFrame

-- Update Title with your specific name
Title.Parent = MainFrame
Title.Text = "  SPECTATE PLAYER V5 INF6"
Title.Size = UDim2.new(1, 0, 0, 30)
Title.TextColor3 = Color3.new(1, 1, 1)
Title.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
Title.TextXAlignment = Enum.TextXAlignment.Left
local TitleCorner = Instance.new("UICorner")
TitleCorner.Parent = Title

MinBtn.Parent = MainFrame
MinBtn.Text = "_"
MinBtn.Size = UDim2.new(0, 30, 0, 30)
MinBtn.Position = UDim2.new(1, -30, 0, 0)
MinBtn.BackgroundTransparency = 1
MinBtn.TextColor3 = Color3.new(1, 1, 1)
MinBtn.TextSize = 20

-- Floating "Open" button logic
OpenBtn.Parent = ScreenGui
OpenBtn.Size = UDim2.new(0, 60, 0, 30)
OpenBtn.Position = UDim2.new(0, 10, 0.5, 0)
OpenBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
OpenBtn.TextColor3 = Color3.new(1, 1, 1)
OpenBtn.Text = "Open"
OpenBtn.Visible = false
OpenBtn.Active = true
OpenBtn.Draggable = true
OpenCorner.Parent = OpenBtn

TargetName.Parent = MainFrame
TargetName.Text = "Status: Idle"
TargetName.Position = UDim2.new(0, 0, 0, 35)
TargetName.Size = UDim2.new(1, 0, 0, 25)
TargetName.TextColor3 = Color3.fromRGB(0, 255, 180)
TargetName.BackgroundTransparency = 1

-- Player Scroll with Fixed Scrolling
PlayerScroll.Parent = MainFrame
PlayerScroll.Size = UDim2.new(0, 210, 0, 200)
PlayerScroll.Position = UDim2.new(1, 10, 0, 0)
PlayerScroll.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
PlayerScroll.Visible = false
PlayerScroll.ScrollBarThickness = 6
PlayerScroll.ScrollingEnabled = true
PlayerScroll.AutomaticCanvasSize = Enum.AutomaticSize.Y -- Correct Scrolling Fix

local ScrollCorner = Instance.new("UICorner")
ScrollCorner.Parent = PlayerScroll

ListLayout.Parent = PlayerScroll
ListLayout.Padding = UDim.new(0, 5)
ListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center

ListPadding.Parent = PlayerScroll
ListPadding.PaddingTop = UDim.new(0, 5)
ListPadding.PaddingBottom = UDim.new(0, 5)

local function styleButton(btn, pos, text, color)
    btn.Parent = MainFrame
    btn.Size = UDim2.new(0, 65, 0, 30)
    btn.Position = pos
    btn.Text = text
    btn.BackgroundColor3 = color or Color3.fromRGB(55, 55, 55)
    btn.TextColor3 = Color3.new(1, 1, 1)
    btn.BorderSizePixel = 0
    local btnCorner = Instance.new("UICorner")
    btnCorner.CornerRadius = UDim.new(0, 6)
    btnCorner.Parent = btn
end

styleButton(PrevBtn, UDim2.new(0, 5, 0, 65), "Prev")
styleButton(StopBtn, UDim2.new(0, 75, 0, 65), "Reset")
styleButton(NextBtn, UDim2.new(0, 145, 0, 65), "Next")
styleButton(ListBtn, UDim2.new(0, 5, 0, 105), "Toggle Player List", Color3.fromRGB(45, 65, 95))
ListBtn.Size = UDim2.new(0, 210, 0, 30)
styleButton(FollowBtn, UDim2.new(0, 5, 0, 145), "Follow Player", Color3.fromRGB(40, 90, 40))
FollowBtn.Size = UDim2.new(0, 210, 0, 35)

--- Logic Functions ---

local function stopFollowing()
    following = false
    FollowBtn.Text = "Follow Player"
    FollowBtn.BackgroundColor3 = Color3.fromRGB(40, 90, 40)
    if followConnection then followConnection:Disconnect() followConnection = nil end
end

local function selectPlayer(p)
    if p and p.Character and p.Character:FindFirstChild("Humanoid") then
        currentTarget = p
        Camera.CameraSubject = p.Character.Humanoid
        TargetName.Text = "Viewing: " .. p.Name
        stopFollowing()
    end
end

MinBtn.MouseButton1Click:Connect(function()
    MainFrame.Visible = false
    OpenBtn.Visible = true
end)

OpenBtn.MouseButton1Click:Connect(function()
    MainFrame.Visible = true
    OpenBtn.Visible = false
end)

local function refreshList()
    for _, child in pairs(PlayerScroll:GetChildren()) do 
        if child:IsA("Frame") then child:Destroy() end 
    end
    
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= LocalPlayer then
            local pFrame = Instance.new("Frame")
            pFrame.Size = UDim2.new(0, 195, 0, 45)
            pFrame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
            pFrame.Parent = PlayerScroll
            local fCorner = Instance.new("UICorner")
            fCorner.Parent = pFrame
            
            local pImg = Instance.new("ImageLabel")
            pImg.Size = UDim2.new(0, 35, 0, 35)
            pImg.Position = UDim2.new(0, 5, 0, 5)
            pImg.BackgroundTransparency = 1
            pImg.Parent = pFrame
            local iCorner = Instance.new("UICorner")
            iCorner.CornerRadius = UDim.new(1, 0)
            iCorner.Parent = pImg
            
            task.spawn(function() 
                pImg.Image = Players:GetUserThumbnailAsync(p.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size48x48) 
            end)
            
            local pBtn = Instance.new("TextButton")
            pBtn.Size = UDim2.new(1, -50, 1, 0)
            pBtn.Position = UDim2.new(0, 50, 0, 0)
            pBtn.Text = p.Name
            pBtn.BackgroundTransparency = 1
            pBtn.TextColor3 = Color3.new(1, 1, 1)
            pBtn.TextXAlignment = Enum.TextXAlignment.Left
            pBtn.Parent = pFrame
            pBtn.MouseButton1Click:Connect(function()
                selectPlayer(p)
                PlayerScroll.Visible = false
                listOpen = false
            end)
        end
    end
end

ListBtn.MouseButton1Click:Connect(function()
    listOpen = not listOpen
    PlayerScroll.Visible = listOpen
    if listOpen then refreshList() end
end)

NextBtn.MouseButton1Click:Connect(function()
    local plrs = {}
    for _, p in pairs(Players:GetPlayers()) do if p ~= LocalPlayer then table.insert(plrs, p) end end
    if #plrs == 0 then return end
    index = (index % #plrs) + 1
    selectPlayer(plrs[index])
end)

PrevBtn.MouseButton1Click:Connect(function()
    local plrs = {}
    for _, p in pairs(Players:GetPlayers()) do if p ~= LocalPlayer then table.insert(plrs, p) end end
    if #plrs == 0 then return end
    index = (index - 2) % #plrs + 1
    selectPlayer(plrs[index])
end)

StopBtn.MouseButton1Click:Connect(function()
    stopFollowing()
    currentTarget = nil
    Camera.CameraSubject = LocalPlayer.Character:FindFirstChild("Humanoid") or LocalPlayer.Character
    TargetName.Text = "Status: Idle"
end)

FollowBtn.MouseButton1Click:Connect(function()
    if following then stopFollowing() else
        if currentTarget and currentTarget.Character then
            following = true
            FollowBtn.Text = "Following..."
            FollowBtn.BackgroundColor3 = Color3.fromRGB(20, 120, 20)
            followConnection = RunService.Heartbeat:Connect(function()
                if following and currentTarget and currentTarget.Character then
                    local myChar = LocalPlayer.Character
                    local targetChar = currentTarget.Character
                    if myChar and targetChar:FindFirstChild("HumanoidRootPart") then
                        myChar.Humanoid:MoveTo(targetChar.HumanoidRootPart.Position - (targetChar.HumanoidRootPart.CFrame.LookVector * 5)) 
                        if targetChar.Humanoid.Jump then myChar.Humanoid.Jump = true end
                    end
                else stopFollowing() end
            end)
        end
    end
end)

Features & Information

script spectat • There are two ways to watch players the first is random and the second is when you choose the player you want The last addition is from me maybe you might like it

Community Comments (2)

inf6inf6Feb 17, 2026

If you like the script give it a like If you encounter any problem please contact me

nikitakalitin2nikitakalitin2Mar 19, 2026

I have problem because didn't use it rn

More Scripts for Universal Scripts