The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
KAT! aim script pastebin roblox
By KAT! on 2024-09-19 08:00 am | Syntax: LUA | Views: 10



New Script | Raw | Show/Hide line no. | Copy text to clipboard
  1.  local localPlayer = game:GetService("Players").LocalPlayer
  2. local currentCamera = game:GetService("Workspace").CurrentCamera
  3. local mouse = localPlayer:GetMouse()
  4.  
  5. local function getClosestPlayerToCursor(x, y)
  6.    local closestPlayer = nil
  7.    local shortestDistance = math.huge
  8.  
  9.    for i, v in pairs(game:GetService("Players"):GetPlayers()) do
  10.        if v ~= localPlayer and v.Character and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Torso") then
  11.            local pos = currentCamera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  12.            local magnitude = (Vector2.new(pos.X, pos.Y) - Vector2.new(x, y)).magnitude
  13.  
  14.            if magnitude < shortestDistance then
  15.                closestPlayer = v
  16.                shortestDistance = magnitude
  17.            end
  18. end
  19.    end
  20.  
  21.    return closestPlayer
  22. end
  23.  
  24. local mt = getrawmetatable(game)
  25. local oldIndex = mt.__index
  26. if setreadonly then setreadonly(mt, false) else make_writeable(mt, true) end
  27. local newClose = newcclosure or function(f) return f end
  28.  
  29. mt.__index = newClose(function(t, k)
  30.    if not checkcaller() and t == mouse and tostring(k) == "X" and string.find(getfenv(2).script.Name, "Client") and getClosestPlayerToCursor() then
  31.     local closest = getClosestPlayerToCursor(oldIndex(t, k), oldIndex(t, "Y")).Character.Torso
  32.     local pos = currentCamera:WorldToScreenPoint(closest.Position)
  33.     return pos.X
  34.    end
  35.    if not checkcaller() and t == mouse and tostring(k) == "Y" and string.find(getfenv(2).script.Name, "Client") and getClosestPlayerToCursor() then
  36.     local closest = getClosestPlayerToCursor(oldIndex(t, "X"), oldIndex(t, k)).Character.Torso
  37.     local pos = currentCamera:WorldToScreenPoint(closest.Position)
  38.     return pos.Y
  39.    end
  40.    if t == mouse and tostring(k) == "Hit" and string.find(getfenv(2).script.Name, "Client") and getClosestPlayerToCursor() then
  41.        return getClosestPlayerToCursor(mouse.X, mouse.Y).Character.Torso.CFrame
  42.    end
  43.  
  44.    return oldIndex(t, k)
  45. end)
  46.  
  47. if setreadonly then setreadonly(mt, true) else make_writeable(mt, false) end