script this dosent have a gui

Вариант без графической панели: удерживание кнопки мыши запускает автоклик, а камера направляется на ближайшего к курсору игрока.

Здесь нет меню настроек: логика работает напрямую с вводом и камерой. Скрипт находит игрока с головой, ближайшей к курсору, и направляет камеру на неё; при удерживании левой или правой кнопки запускается повторный клик. Проверка состояния игрового лобби приостанавливает автоклик. Поэтому этот исходник сочетает наведение с обработкой нажатий мыши, хотя в сохранённых canonical features указано только скрытое наведение.

Функции

  • Скрытое наведение

Lua-код

Lua
-- When the player right-clicks, the script will automatically fire continuously.  
-- When the player left-clicks, the script will fire a single bullet. If the player were to regularly hold the left click to allow the gun to go full auto, the silent aim would not go into full effect.

-- Due to the way I manipulate the camera, it is necessary to implement the shooting mechanics in this specific manner.
-- WORKS ON ALL EXECUTORS

print("works")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local localPlayer = Players.LocalPlayer
local camera = workspace.CurrentCamera

local targetPlayer = nil
local ClickInterval = 0.10
local isLeftMouseDown = false
local isRightMouseDown = false
local autoClickConnection = nil

local function isLobbyVisible()
    return localPlayer.PlayerGui.MainGui.MainFrame.Lobby.Currency.Visible == true
end

local function getClosestPlayerToMouse()
    local closestPlayer = nil
    local shortestDistance = math.huge
    local mousePosition = UserInputService:GetMouseLocation()

    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= localPlayer and player.Character and player.Character:FindFirstChild("Head") then
            local head = player.Character.Head
            local headPosition, onScreen = camera:WorldToViewportPoint(head.Position)

            if onScreen then
                local screenPosition = Vector2.new(headPosition.X, headPosition.Y)
                local distance = (screenPosition - mousePosition).Magnitude

                if distance < shortestDistance then
                    closestPlayer = player
                    shortestDistance = distance
                end
            end
        end
    end

    return closestPlayer
end

local function lockCameraToHead()
    if targetPlayer and targetPlayer.Character and targetPlayer.Character:FindFirstChild("Head") then
        local head = targetPlayer.Character.Head
        local headPosition = camera:WorldToViewportPoint(head.Position)
        if headPosition.Z > 0 then
            local cameraPosition = camera.CFrame.Position
            local direction = (head.Position - cameraPosition).Unit
            camera.CFrame = CFrame.new(cameraPosition, head.Position)
        end
    end
end

local function autoClick()
    if autoClickConnection then
        autoClickConnection:Disconnect()
    end
    autoClickConnection = RunService.Heartbeat:Connect(function()
        if isLeftMouseDown or isRightMouseDown then
            if not isLobbyVisible() then
                mouse1click()
            end
        else
            autoClickConnection:Disconnect()
        end
    end)
end

UserInputService.InputBegan:Connect(function(input, isProcessed)
    if input.UserInputType == Enum.UserInputType.MouseButton1 and not isProcessed then
        if not isLeftMouseDown then
            isLeftMouseDown = true
            autoClick()
        end
    elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not isProcessed then
        if not isRightMouseDown then
            isRightMouseDown = true
            autoClick()
        end
    end
end)

UserInputService.InputEnded:Connect(function(input, isProcessed)
    if input.UserInputType == Enum.UserInputType.MouseButton1 and not isProcessed then
        isLeftMouseDown = false
    elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not isProcessed then
        isRightMouseDown = false
    end
end)

RunService.Heartbeat:Connect(function()
    if not isLobbyVisible() then
        targetPlayer = getClosestPlayerToMouse()
        if targetPlayer then
            lockCameraToHead()
        end
    end
end)

Перед использованием проверьте код и учитывайте правила Roblox.

Характеристики

Ключ
Не указано
Автор
jedexploiter

Как запустить скрипт в RIVALS

Используйте код только там, где запуск Lua разрешён правилами площадки и проекта.

  1. Ознакомьтесь с кодом и его назначением.
  2. Нажмите «Копировать», чтобы получить весь Lua-текст.
  3. Откройте проект или среду, где запуск Lua разрешён.
  4. Вставьте код и следуйте правилам выбранной среды.

Подробное руководство