Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Settings
- local aimlockRange = 100 -- Adjust the range to your preference
- local predictionFactor = 0.13 -- Adjust the prediction factor to your preference
- -- Create ScreenGui and Button
- local gui = Instance.new("ScreenGui")
- gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 100, 0, 50)
- button.Position = UDim2.new(0.5, -50, 0.5, -25)
- button.Text = "Aimlock (OFF)"
- button.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red color
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.Parent = gui
- -- Enable Dragging for the Button
- local UIS = game:GetService("UserInputService")
- local dragging = false
- local dragInput, mousePos, framePos
- button.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- mousePos = input.Position
- framePos = button.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- button.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UIS.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - mousePos
- button.Position = UDim2.new(
- framePos.X.Scale,
- framePos.X.Offset + delta.X,
- framePos.Y.Scale,
- framePos.Y.Offset + delta.Y
- )
- end
- end)
- -- Function to toggle aimlock
- local aimlockEnabled = false
- local lockedPlayer = nil
- local function toggleAimlock()
- aimlockEnabled = not aimlockEnabled
- if aimlockEnabled then
- button.Text = "Aimlock (ON)"
- button.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green color
- lockedPlayer = findNearestPlayer() -- Find the nearest player when aimlock is enabled
- else
- button.Text = "Aimlock (OFF)"
- button.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red color
- lockedPlayer = nil
- end
- end
- -- Toggle aimlock when button is clicked
- button.MouseButton1Click:Connect(toggleAimlock)
- -- Function to find nearest player
- local function findNearestPlayer()
- local mouse = game.Players.LocalPlayer:GetMouse()
- local target = nil
- local minDist = aimlockRange
- for _, player in ipairs(game.Players:GetPlayers()) do
- if player ~= game.Players.LocalPlayer and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
- local char = player.Character
- local dist = (char.HumanoidRootPart.Position - mouse.Hit.p).magnitude
- if dist < minDist then
- minDist = dist
- target = char.HumanoidRootPart
- end
- end
- end
- return target
- end
- -- Function to handle aimlock rendering with prediction
- game:GetService("RunService").RenderStepped:Connect(function()
- if aimlockEnabled and lockedPlayer then
- local targetPos = lockedPlayer.Position
- local targetVelocity = lockedPlayer.Velocity
- local predictedPos = targetPos + targetVelocity * predictionFactor
- local camera = game.Workspace.CurrentCamera
- camera.CFrame = CFrame.new(camera.CFrame.Position, predictedPos)
- end
- end)
- -- Handle aimlock behavior with 'F' key
- game:GetService("UserInputService").InputBegan:Connect(function(input)
- if input.KeyCode == Enum.KeyCode.F then
- if aimlockEnabled and lockedPlayer then
- lockedPlayer = nil
- button.Text = "Aimlock (ON)"
- button.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green color
- elseif aimlockEnabled then
- lockedPlayer = findNearestPlayer()
- end
- end
- end)
Advertisement
Comments
-
- this is not a aimlock is lit a aimbot
-
- super pro hack universal :))))))))))))
Add Comment
Please, Sign In to add comment
Advertisement