Universal Script 📌
3.6k Views
1.0k Executions

Universal Head Lock On Script

Universal Script 📌
YoriScripts
YoriScriptsFirst script
1 year ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

Locks On To Players Head Works In Any Game On Roblox

View Raw
-- Head Lock-On System (Client-Side)
-- Keybind: X to toggle

local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local targetLock = false
local lockedPlayer = nil

local function getClosestPlayer()
    local closest = nil
    local shortestDist = math.huge

    for _, player in pairs(Players:GetPlayers()) do
        if player ~= LocalPlayer and player.Character then
            local head = player.Character:FindFirstChild("Head")
            if head then
                local screenPos = workspace.CurrentCamera:WorldToScreenPoint(head.Position)
                local mousePos = Vector2.new(Mouse.X, Mouse.Y)
                local distance = (mousePos - Vector2.new(screenPos.X, screenPos.Y)).Magnitude

                if distance < shortestDist then
                    shortestDist = distance
                    closest = player
                end
            end
        end
    end

    return closest
end

local function lockOn()
    local target = getClosestPlayer()
    if target and target.Character then
        local head = target.Character:FindFirstChild("Head")
        if head then


Comments

4
Log in to join the conversation. Login
noah97953's profile picture
noah979538 months ago

it supa great! i used it in fng with rtimpact fruit

1
gav1010101010's profile picture
gav10101010101 year ago

works great for rivals

1
YoriScripts's profile picture
YoriScriptsUploader1 year ago

@gav1010101010 That's nice

1
YoriScripts's profile picture
YoriScriptsUploader1 year ago

Enjoy The Script!

1

More universal scripts

See all
Universal Script 📌
10
0
Approved 5 minutes ago
Universal Script 📌
11
0
Approved 14 minutes ago
Script hub
23.9k
117.7k
Bumped 2 hours ago
Key System
Script hub
46.5k
206.9k
Bumped 2 hours ago

Script hub

Sp3arParvus

Universal Script 📌
41
5
Approved 2 hours ago
Script hub
41
4
Approved 3 hours ago
Key System

Script hub

Friedpotato Hub