XSilentmia

Pasted Nov 12, 2026, 2:06 PM1 file562 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/detectorsa
XSilentmia
--=============================================================================
--  Remote Shooter Detector  (+ copy support)
--=============================================================================

local Players          = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local LocalPlayer = Players.LocalPlayer
local playerGui   = LocalPlayer:WaitForChild("PlayerGui")

--=============================================================================
-- CONFIG
--=============================================================================
local Config = {
    AutoCapture         = true,
    AutoCaptureWindow   = 1.5,
    ManualCaptureWindow = 5.0,
    MaxLogEntries       = 30,
    IgnoreHeartbeat     = true,
    IgnoreNames         = { "heartbeat", "ping", "keepalive", "tick" },
}

local ACCENT     = Color3.fromRGB(0, 255, 120)
local ACCENT_DK  = Color3.fromRGB(0, 170, 80)
local BG_MAIN    = Color3.fromRGB(22, 22, 28)
local BG_HEADER  = Color3.fromRGB(30, 30, 40)
local BG_ROW     = Color3.fromRGB(38, 38, 48)
local BG_ROW2    = Color3.fromRGB(48, 48, 58)
local TEXT_WHITE = Color3.fromRGB(240, 240, 240)

--=============================================================================
-- STATE
--=============================================================================
local captureUntil = 0
local logEntries   = {}   -- array of { row=Frame, text=string }

--=============================================================================
-- CLIPBOARD (with fallback)
--=============================================================================
local function copyText(text)
    -- Preferred: executor's setclipboard
    if typeof(setclipboard) == "function" then
        local ok = pcall(setclipboard, text)
        if ok then return true end
    end
    if typeof(toclipboard) == "function" then
        local ok = pcall(toclipboard, text)
        if ok then return true end
    end
    if syn and typeof(syn.writeclipboard) == "function" then
        local ok = pcall(syn.writeclipboard, text)
        if ok then return true end
    end
    -- Fallback: TextBox the user can copy from
    local sg = Instance.new("ScreenGui")
    sg.Name = "ClipboardFallback"
    sg.ResetOnSpawn = false
    sg.DisplayOrder = 2000
    sg.IgnoreGuiInset = true
    sg.Parent = playerGui

    local frame = Instance.new("Frame")
    frame.Size = UDim2.new(0, 460, 0, 260)
    frame.Position = UDim2.new(0.5, -230, 0.5, -130)
    frame.BackgroundColor3 = BG_MAIN
    frame.BorderSizePixel = 0
    frame.Parent = sg
    local c = Instance.new("UICorner"); c.CornerRadius = UDim.new(0, 10); c.Parent = frame
    local s = Instance.new("UIStroke"); s.Color = ACCENT; s.Thickness = 1.5; s.Parent = frame

    local box = Instance.new("TextBox")
    box.Size = UDim2.new(1, -20, 1, -70)
    box.Position = UDim2.new(0, 10, 0, 10)
    box.BackgroundColor3 = BG_ROW
    box.TextColor3 = TEXT_WHITE
    box.TextScaled = false
    box.TextSize = 14
    box.Font = Enum.Font.Code
    box.TextWrapped = true
    box.TextXAlignment = Enum.TextXAlignment.Left
    box.TextYAlignment = Enum.TextYAlignment.Top
    box.Text = text
    box.ClearTextOnFocus = false
    box.MultiLine = true
    box.Parent = frame
    local bc = Instance.new("UICorner"); bc.CornerRadius = UDim.new(0, 6); bc.Parent = box

    local closeB = Instance.new("TextButton")
    closeB.Size = UDim2.new(0, 100, 0, 32)
    closeB.Position = UDim2.new(1, -110, 1, -42)
    closeB.BackgroundColor3 = ACCENT_DK
    closeB.Text = "Close"
    closeB.TextColor3 = Color3.new(1,1,1)
    closeB.Font = Enum.Font.GothamBold
    closeB.TextScaled = true
    closeB.Parent = frame
    local cc = Instance.new("UICorner"); cc.CornerRadius = UDim.new(0, 6); cc.Parent = closeB
    closeB.MouseButton1Click:Connect(function() sg:Destroy() end)

    box:CaptureFocus()
    box.CursorPosition = #text + 1
    return false
end

--=============================================================================
-- HELPERS
--=============================================================================
local function isIgnored(name)
    if not Config.IgnoreHeartbeat then return false end
    local lower = name:lower()
    for _, needle in ipairs(Config.IgnoreNames) do
        if lower:find(needle, 1, true) then return true end
    end
    return false
end

local function getPath(obj)
    local parts, cur = {}, obj
    while cur and cur ~= game and cur.Parent do
        local name = cur.Name
        local parent = cur.Parent
        local count, idx = 0, 1
        for _, c in ipairs(parent:GetChildren()) do
            if c.Name == name then
                count = count + 1
                if c == cur then idx = count end
            end
        end
        if count > 1 then name = name .. "[" .. idx .. "]" end
        table.insert(parts, 1, name)
        cur = parent
    end
    return "game/" .. table.concat(parts, "/")
end

local function ser(v, depth)
    depth = depth or 0
    if depth > 2 then return "..." end
    local t = typeof(v)
    if t == "Instance" then
        if v:IsA("Player") then return "Player:" .. v.Name end
        return v.ClassName .. ":" .. v.Name
    elseif t == "table" then
        local out, n = {}, 0
        for k, val in pairs(v) do
            n = n + 1
            if n > 6 then out[#out + 1] = "..."; break end
            out[#out + 1] = tostring(k) .. "=" .. ser(val, depth + 1)
        end
        return "{" .. table.concat(out, ", ") .. "}"
    elseif t == "string" then
        local s = v:gsub("[\n\r]", " ")
        if #s > 60 then s = s:sub(1, 60) .. "…" end
        return string.format("%q", s)
    elseif t == "EnumItem" then
        return v.Name
    else
        return tostring(v)
    end
end

local function serArgs(args)
    local parts = {}
    local limit = math.min(#args, 5)
    for i = 1, limit do parts[i] = ser(args[i]) end
    if #args > limit then parts[#parts + 1] = "…(+" .. (#args - limit) .. ")" end
    return table.concat(parts, ", ")
end

local function buildCopyText(method, path, argsStr, caller)
    return table.concat({
        "method: " .. method,
        "path: " .. path,
        "args: " .. argsStr,
        "caller: " .. (caller or "?"),
    }, "\n")
end

--=============================================================================
-- GUI
--=============================================================================
local oldGui = playerGui:FindFirstChild("RemoteShooterDetector")
if oldGui then oldGui:Destroy() end

local screenGui = Instance.new("ScreenGui")
screenGui.Name           = "RemoteShooterDetector"
screenGui.ResetOnSpawn   = false
screenGui.IgnoreGuiInset = true
screenGui.DisplayOrder   = 999
screenGui.Parent         = playerGui

-- Toast -----------------------------------------------------------------
local toast = Instance.new("Frame")
toast.Size                   = UDim2.new(0, 380, 0, 96)
toast.Position               = UDim2.new(0.5, -190, 0, 60)
toast.BackgroundColor3       = BG_MAIN
toast.BackgroundTransparency = 1
toast.BorderSizePixel        = 0
toast.Visible                = false
toast.ZIndex                 = 10
toast.Parent                 = screenGui
local toastCorner = Instance.new("UICorner"); toastCorner.CornerRadius = UDim.new(0, 10); toastCorner.Parent = toast
local toastStroke = Instance.new("UIStroke"); toastStroke.Thickness = 1.5; toastStroke.Color = ACCENT; toastStroke.Transparency = 1; toastStroke.Parent = toast

local toastTitle = Instance.new("TextLabel")
toastTitle.Size = UDim2.new(1, -20, 0, 24)
toastTitle.Position = UDim2.new(0, 10, 0, 6)
toastTitle.BackgroundTransparency = 1
toastTitle.Text = ""
toastTitle.TextColor3 = ACCENT
toastTitle.TextScaled = true
toastTitle.Font = Enum.Font.GothamBold
toastTitle.TextXAlignment = Enum.TextXAlignment.Left
toastTitle.TextTransparency = 1
toastTitle.ZIndex = 11
toastTitle.Parent = toast

local toastBody = Instance.new("TextLabel")
toastBody.Size = UDim2.new(1, -20, 1, -32)
toastBody.Position = UDim2.new(0, 10, 0, 28)
toastBody.BackgroundTransparency = 1
toastBody.Text = ""
toastBody.TextColor3 = TEXT_WHITE
toastBody.TextWrapped = true
toastBody.TextScaled = true
toastBody.Font = Enum.Font.Code
toastBody.TextXAlignment = Enum.TextXAlignment.Left
toastBody.TextYAlignment = Enum.TextYAlignment.Top
toastBody.TextTransparency = 1
toastBody.ZIndex = 11
toastBody.Parent = toast

local toastHideToken = 0
local toastCopyText  = ""

local toastBtn = Instance.new("TextButton")
toastBtn.Size = UDim2.new(1, 0, 1, 0)
toastBtn.BackgroundTransparency = 1
toastBtn.Text = ""
toastBtn.ZIndex = 12
toastBtn.Parent = toast
toastBtn.MouseButton1Click:Connect(function()
    if toastCopyText ~= "" then copyText(toastCopyText) end
end)

local function showToast(title, body, copyStr)
    toastHideToken = toastHideToken + 1
    local myToken = toastHideToken
    toastTitle.Text = title
    toastBody.Text  = body .. "\n(tap to copy)"
    toastCopyText   = copyStr or ""
    toast.Visible   = true
    toast.BackgroundTransparency = 0.1
    toastStroke.Transparency     = 0.3
    toastTitle.TextTransparency  = 0
    toastBody.TextTransparency   = 0
    task.delay(4, function()
        if myToken ~= toastHideToken then return end
        for i = 1, 20 do
            if myToken ~= toastHideToken then return end
            local a = i / 20
            toast.BackgroundTransparency = 0.1 + a * 0.9
            toastStroke.Transparency     = 0.3 + a * 0.7
            toastTitle.TextTransparency  = a
            toastBody.TextTransparency   = a
            task.wait(0.03)
        end
        if myToken == toastHideToken then toast.Visible = false end
    end)
end

-- Main window -----------------------------------------------------------
local EXPANDED_SIZE  = UDim2.new(0, 360, 0, 380)
local COLLAPSED_SIZE = UDim2.new(0, 360, 0, 38)

local mainFrame = Instance.new("Frame")
mainFrame.Size = EXPANDED_SIZE
mainFrame.Position = UDim2.new(0, 20, 0, 20)
mainFrame.BackgroundColor3 = BG_MAIN
mainFrame.BorderSizePixel = 0
mainFrame.ClipsDescendants = true
mainFrame.Parent = screenGui
local mainCorner = Instance.new("UICorner"); mainCorner.CornerRadius = UDim.new(0, 10); mainCorner.Parent = mainFrame
local mainStroke = Instance.new("UIStroke"); mainStroke.Thickness = 1.5; mainStroke.Color = ACCENT; mainStroke.Parent = mainFrame

local titleBar = Instance.new("Frame")
titleBar.Size = UDim2.new(1, 0, 0, 38)
titleBar.BackgroundColor3 = BG_HEADER
titleBar.BorderSizePixel = 0
titleBar.Parent = mainFrame

local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -80, 1, 0)
titleLabel.Position = UDim2.new(0, 12, 0, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Remote Shooter Detector"
titleLabel.TextColor3 = ACCENT
titleLabel.TextScaled = true
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = titleBar

local function makeTitleButton(text, xOff, color)
    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0, 30, 0, 30)
    btn.Position = UDim2.new(1, xOff, 0, 4)
    btn.BackgroundColor3 = color
    btn.Text = text
    btn.TextColor3 = Color3.new(1,1,1)
    btn.TextScaled = true
    btn.Font = Enum.Font.GothamBold
    btn.Parent = titleBar
    local c = Instance.new("UICorner"); c.CornerRadius = UDim.new(0, 6); c.Parent = btn
    return btn
end

local minBtn   = makeTitleButton("—", -70, Color3.fromRGB(70, 70, 85))
local closeBtn = makeTitleButton("✕", -36, Color3.fromRGB(200, 55, 55))

-- Drag ------------------------------------------------------------------
local dragging, dragInput, dragStart, dragOrigin = false, nil, nil, nil
titleBar.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1
    or input.UserInputType == Enum.UserInputType.Touch then
        dragging, dragInput = true, input
        dragStart  = input.Position
        dragOrigin = mainFrame.Position
    end
end)
UserInputService.InputChanged:Connect(function(input)
    if not dragging or input ~= dragInput then return end
    local d = input.Position - dragStart
    mainFrame.Position = UDim2.new(
        dragOrigin.X.Scale, dragOrigin.X.Offset + d.X,
        dragOrigin.Y.Scale, dragOrigin.Y.Offset + d.Y
    )
end)
UserInputService.InputEnded:Connect(function(input)
    if input == dragInput then dragging, dragInput = false, nil end
end)

-- Controls row ----------------------------------------------------------
local controls = Instance.new("Frame")
controls.Size = UDim2.new(1, -8, 0, 36)
controls.Position = UDim2.new(0, 4, 0, 42)
controls.BackgroundTransparency = 1
controls.Parent = mainFrame

local function makeCtrlBtn(text, x, w, color)
    local b = Instance.new("TextButton")
    b.Size = UDim2.new(0, w, 1, 0)
    b.Position = UDim2.new(0, x, 0, 0)
    b.BackgroundColor3 = color
    b.Text = text
    b.TextColor3 = Color3.new(1,1,1)
    b.TextScaled = true
    b.Font = Enum.Font.GothamBold
    b.Parent = controls
    local c = Instance.new("UICorner"); c.CornerRadius = UDim.new(0, 6); c.Parent = b
    return b
end

local armBtn   = makeCtrlBtn("Arm 5s",  0,   80, ACCENT_DK)
local autoBtn  = makeCtrlBtn("Click: ON", 84, 90, Config.AutoCapture and ACCENT_DK or BG_ROW)
local copyAllBtn = makeCtrlBtn("Copy All", 178, 90, BG_ROW2)
local clearBtn = makeCtrlBtn("Clear", 272, 80, BG_ROW)

-- Log list --------------------------------------------------------------
local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Size = UDim2.new(1, -8, 1, -86)
scrollFrame.Position = UDim2.new(0, 4, 0, 82)
scrollFrame.BackgroundTransparency = 1
scrollFrame.BorderSizePixel = 0
scrollFrame.ScrollBarThickness = 4
scrollFrame.ScrollBarImageColor3 = ACCENT
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
scrollFrame.AutomaticCanvasSize = Enum.AutomaticSize.Y
scrollFrame.Parent = mainFrame

local listLayout = Instance.new("UIListLayout")
listLayout.SortOrder = Enum.SortOrder.LayoutOrder
listLayout.Padding = UDim.new(0, 4)
listLayout.Parent = scrollFrame

--=============================================================================
-- LOG ENTRY
--=============================================================================
local function addLogEntry(path, method, argsStr, caller)
    local copyText_str = buildCopyText(method, path, argsStr, caller)

    local row = Instance.new("Frame")
    row.Size = UDim2.new(1, -6, 0, 74)
    row.BackgroundColor3 = BG_ROW
    row.BorderSizePixel = 0
    row.Parent = scrollFrame
    local rc = Instance.new("UICorner"); rc.CornerRadius = UDim.new(0, 6); rc.Parent = row

    local head = Instance.new("TextLabel")
    head.Size = UDim2.new(1, -70, 0, 18)
    head.Position = UDim2.new(0, 6, 0, 3)
    head.BackgroundTransparency = 1
    head.Text = method .. "  →  " .. path
    head.TextColor3 = ACCENT
    head.TextScaled = true
    head.Font = Enum.Font.GothamBold
    head.TextXAlignment = Enum.TextXAlignment.Left
    head.Parent = row

    local argsLabel = Instance.new("TextLabel")
    argsLabel.Size = UDim2.new(1, -12, 0, 22)
    argsLabel.Position = UDim2.new(0, 6, 0, 22)
    argsLabel.BackgroundTransparency = 1
    argsLabel.Text = "args: " .. argsStr
    argsLabel.TextColor3 = TEXT_WHITE
    argsLabel.TextScaled = true
    argsLabel.Font = Enum.Font.Code
    argsLabel.TextXAlignment = Enum.TextXAlignment.Left
    argsLabel.Parent = row

    local callerLabel = Instance.new("TextLabel")
    callerLabel.Size = UDim2.new(1, -12, 0, 16)
    callerLabel.Position = UDim2.new(0, 6, 0, 46)
    callerLabel.BackgroundTransparency = 1
    callerLabel.Text = "caller: " .. (caller or "(unknown)")
    callerLabel.TextColor3 = Color3.fromRGB(180, 180, 190)
    callerLabel.TextScaled = true
    callerLabel.Font = Enum.Font.Code
    callerLabel.TextXAlignment = Enum.TextXAlignment.Left
    callerLabel.Parent = row

    -- Copy button
    local copyBtn = Instance.new("TextButton")
    copyBtn.Size = UDim2.new(0, 60, 0, 18)
    copyBtn.Position = UDim2.new(1, -66, 0, 3)
    copyBtn.BackgroundColor3 = ACCENT_DK
    copyBtn.Text = "Copy"
    copyBtn.TextColor3 = Color3.new(1,1,1)
    copyBtn.TextScaled = true
    copyBtn.Font = Enum.Font.GothamBold
    copyBtn.Parent = row
    local cbc = Instance.new("UICorner"); cbc.CornerRadius = UDim.new(0, 4); cbc.Parent = copyBtn
    copyBtn.MouseButton1Click:Connect(function()
        local ok = copyText(copyText_str)
        if ok then
            copyBtn.Text = "Copied!"
            task.delay(1, function()
                if copyBtn and copyBtn.Parent then copyBtn.Text = "Copy" end
            end)
        end
    end)

    table.insert(logEntries, 1, { row = row, text = copyText_str })
    while #logEntries > Config.MaxLogEntries do
        local old = table.remove(logEntries)
        if old and old.row then old.row:Destroy() end
    end
end

--=============================================================================
-- CAPTURE HANDLER
--=============================================================================
local function onRemoteCaptured(remote, method, args)
    if isIgnored(remote.Name) then return end

    local path = getPath(remote)
    local argsStr = serArgs(args)
    local caller
    local ok, c = pcall(getcallingscript)
    if ok and c then caller = c:GetFullName() end

    local copyStr = buildCopyText(method, path, argsStr, caller)

    showToast(method .. ": " .. remote.Name, path .. "\n" .. argsStr, copyStr)
    addLogEntry(path, method, argsStr, caller)

    print(("[RemoteShooterDetector] %s %s | args: %s | caller: %s"):format(
        method, path, argsStr, caller or "?"
    ))
end

--=============================================================================
-- INPUT → arm
--=============================================================================
UserInputService.InputBegan:Connect(function(input, gp)
    if gp then return end
    if Config.AutoCapture and (
        input.UserInputType == Enum.UserInputType.MouseButton1
        or input.UserInputType == Enum.UserInputType.Touch
    ) then
        local newUntil = os.clock() + Config.AutoCaptureWindow
        if newUntil > captureUntil then captureUntil = newUntil end
    end
end)

armBtn.MouseButton1Click:Connect(function()
    captureUntil = os.clock() + Config.ManualCaptureWindow
    showToast("Armed", "Capturing remotes for " .. Config.ManualCaptureWindow .. "s", "")
end)

autoBtn.MouseButton1Click:Connect(function()
    Config.AutoCapture = not Config.AutoCapture
    autoBtn.Text = "Click: " .. (Config.AutoCapture and "ON" or "OFF")
    autoBtn.BackgroundColor3 = Config.AutoCapture and ACCENT_DK or BG_ROW
end)

copyAllBtn.MouseButton1Click:Connect(function()
    if #logEntries == 0 then
        showToast("Copy All", "Nothing captured yet.", "")
        return
    end
    local out = {}
    -- logEntries is newest-first; reverse for chronological output
    for i = #logEntries, 1, -1 do
        out[#out + 1] = ("--- #%d ---\n%s"):format(#logEntries - i + 1, logEntries[i].text)
    end
    local payload = table.concat(out, "\n\n")
    local ok = copyText(payload)
    copyAllBtn.Text = ok and "Copied!" or "See box"
    task.delay(1.2, function()
        if copyAllBtn and copyAllBtn.Parent then copyAllBtn.Text = "Copy All" end
    end)
end)

clearBtn.MouseButton1Click:Connect(function()
    for _, e in ipairs(logEntries) do
        if e.row then e.row:Destroy() end
    end
    logEntries = {}
end)

--=============================================================================
-- MINIMIZE / CLOSE
--=============================================================================
local minimized = false
minBtn.MouseButton1Click:Connect(function()
    minimized = not minimized
    scrollFrame.Visible = not minimized
    controls.Visible    = not minimized
    mainFrame.Size      = minimized and COLLAPSED_SIZE or EXPANDED_SIZE
    minBtn.Text         = minimized and "□" or "—"
end)

closeBtn.MouseButton1Click:Connect(function()
    screenGui:Destroy()
end)

--=============================================================================
-- HOOK
--=============================================================================
local oldNamecall
oldNamecall = hookmetamethod(game, "__namecall", function(self, ...)
    local method = getnamecallmethod()
    if (method == "FireServer" or method == "InvokeServer")
        and os.clock() < captureUntil
        and typeof(self) == "Instance"
        and (self:IsA("RemoteEvent") or self:IsA("RemoteFunction") or self:IsA("UnreliableRemoteEvent"))
    then
        local args = { ... }
        pcall(onRemoteCaptured, self, method, args)
    end
    return oldNamecall(self, ...)
end)

20,650 chars · codepastes.com