View difference between Paste ID: y3xfw5ZR and aHEV3rSK
SHOW: | | - or go back to the newest paste.
1-
local teamCheck = false
1+
local teamCheck = true
2
local fov = 90
3
local smoothing = 1
4
local predictionFactor = 0  -- Adjust this factor to improve prediction accuracy
5
local highlightEnabled = false  -- Variable to enable or disable target highlighting. Change to False if using an ESP script.
6
local lockPart = "Head"  -- Choose what part it locks onto. Ex. HumanoidRootPart or Head
7
8
local Toggle = false  -- Enable or disable toggle mode
9
local ToggleKey = Enum.KeyCode.E  -- Choose the key for toggling aimbot lock
10
11
local RunService = game:GetService("RunService")
12
local UserInputService = game:GetService("UserInputService")
13
local StarterGui = game:GetService("StarterGui")
14
local Players = game:GetService("Players")
15
16
StarterGui:SetCore("SendNotification", {
17
    Title = "Universal Aimbot";
18
    Text = "me";
19
    Duration = 5;
20
})
21
22
local FOVring = Drawing.new("Circle")
23
FOVring.Visible = true
24
FOVring.Thickness = 1
25
FOVring.Radius = fov
26
FOVring.Transparency = 0.8
27
FOVring.Color = Color3.fromRGB(255, 128, 128)
28
FOVring.Position = workspace.CurrentCamera.ViewportSize / 2
29
30
local currentTarget = nil
31
local aimbotEnabled = true
32
local toggleState = false  -- Variable to keep track of toggle state
33
local debounce = false  -- Debounce variable
34
35
local function getClosest(cframe)
36
    local ray = Ray.new(cframe.Position, cframe.LookVector).Unit
37
    local target = nil
38
    local mag = math.huge
39
    local screenCenter = workspace.CurrentCamera.ViewportSize / 2
40
41
    for i, v in pairs(Players:GetPlayers()) do
42
        if v.Character and v.Character:FindFirstChild(lockPart) and v.Character:FindFirstChild("Humanoid") and v.Character:FindFirstChild("HumanoidRootPart") and v ~= Players.LocalPlayer and (v.Team ~= Players.LocalPlayer.Team or (not teamCheck)) then
43
            local screenPoint, onScreen = workspace.CurrentCamera:WorldToViewportPoint(v.Character[lockPart].Position)
44
            local distanceFromCenter = (Vector2.new(screenPoint.X, screenPoint.Y) - screenCenter).Magnitude
45
46
            if onScreen and distanceFromCenter <= fov then
47
                local magBuf = (v.Character[lockPart].Position - ray:ClosestPoint(v.Character[lockPart].Position)).Magnitude
48
49
                if magBuf < mag then
50
                    mag = magBuf
51
                    target = v
52
                end
53
            end
54
        end
55
    end
56
57
    return target
58
end
59
60
local function updateFOVRing()
61
    FOVring.Position = workspace.CurrentCamera.ViewportSize / 2
62
end
63
64
local function highlightTarget(target)
65
    if highlightEnabled and target and target.Character then
66
        local highlight = Instance.new("Highlight")
67
        highlight.Adornee = target.Character
68
        highlight.FillColor = Color3.fromRGB(255, 128, 128)
69
        highlight.OutlineColor = Color3.fromRGB(255, 0, 0)
70
        highlight.Parent = target.Character
71
    end
72
end
73
74
local function removeHighlight(target)
75
    if highlightEnabled and target and target.Character and target.Character:FindFirstChildOfClass("Highlight") then
76
        target.Character:FindFirstChildOfClass("Highlight"):Destroy()
77
    end
78
end
79
80
local function predictPosition(target)
81
    if target and target.Character and target.Character:FindFirstChild("HumanoidRootPart") then
82
        local velocity = target.Character.HumanoidRootPart.Velocity
83
        local position = target.Character[lockPart].Position
84
        local predictedPosition = position + (velocity * predictionFactor)
85
        return predictedPosition
86
    end
87
    return nil
88
end
89
90
local function handleToggle()
91
    if debounce then return end
92
    debounce = true
93
    toggleState = not toggleState
94
    wait(0.3)  -- Debounce time to prevent multiple toggles
95
    debounce = false
96
end
97
98
loop = RunService.RenderStepped:Connect(function()
99
    if aimbotEnabled then
100
        updateFOVRing()
101
102
        local localPlayer = Players.LocalPlayer.Character
103
        local cam = workspace.CurrentCamera
104
        local screenCenter = workspace.CurrentCamera.ViewportSize / 2
105
106
        if Toggle then
107
            if UserInputService:IsKeyDown(ToggleKey) then
108
                handleToggle()
109
            end
110
        else
111
            toggleState = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
112
        end
113
114
        if toggleState then
115
            if not currentTarget then
116
                currentTarget = getClosest(cam.CFrame)
117
                highlightTarget(currentTarget)  -- Highlight the new target if enabled
118
            end
119
120
            if currentTarget and currentTarget.Character and currentTarget.Character:FindFirstChild(lockPart) then
121
                local predictedPosition = predictPosition(currentTarget)
122
                if predictedPosition then
123
                    workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:Lerp(CFrame.new(cam.CFrame.Position, predictedPosition), smoothing)
124
                end
125
                FOVring.Color = Color3.fromRGB(0, 255, 0)  -- Change FOV ring color to green when locked onto a target
126
            else
127
                FOVring.Color = Color3.fromRGB(255, 128, 128)  -- Revert FOV ring color to original when not locked onto a target
128
            end
129
        else
130
            if currentTarget and highlightEnabled then
131
                removeHighlight(currentTarget)  -- Remove highlight from the old target
132
            end
133
            currentTarget = nil
134
            FOVring.Color = Color3.fromRGB(255, 128, 128)  -- Revert FOV ring color to original when not locked onto a target
135
        end
136
    end
137
end)
138