if not game:GetService("RunService"):IsClient() then return end local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Camera = workspace.CurrentCamera local LocalPlayer = Players.LocalPlayer local AimLockEnabled = false local PredictEnabled = false local AimPlayers = false -- false = NPC/Bot, true = Player local LockedPart = nil local Settings = { BulletSpeed = 350, MaxDistance = 450 } -- =================== UTILS =================== local function isPlayerCharacter(model) return Players:GetPlayerFromCharacter(model) ~= nil end local rayParams = RaycastParams.new() rayParams.FilterType = Enum.RaycastFilterType.Blacklist local function isVisible(part) rayParams.FilterDescendantsInstances = {LocalPlayer.Character} local origin = Camera.CFrame.Position local direction = part.Position - origin local result = workspace:Raycast(origin, direction, rayParams) return result and result.Instance:IsDescendantOf(part.Parent) end local function getAimParts(model) local parts = {} local head = model:FindFirstChild("Head") if head then table.insert(parts, head) end local torso = model:FindFirstChild("UpperTorso") or model:FindFirstChild("Torso") or model:FindFirstChild("HumanoidRootPart") if torso then table.insert(parts, torso) end return parts end -- =================== PREDICT =================== local function getPredictedPosition(part, humanoid) if not PredictEnabled then return part.Position end local root = humanoid.Parent:FindFirstChild("HumanoidRootPart") if not root then return part.Position end local velocity = root.AssemblyLinearVelocity local distance = (Camera.CFrame.Position - part.Position).Magnitude local travelTime = distance / math.max(Settings.BulletSpeed, 1) return part.Position + (velocity * travelTime) end -- =================== TARGET FIND =================== local function findNewTarget() local closestPart = nil local shortestDist = math.huge local screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2) for _, model in ipairs(workspace:GetDescendants()) do if model:IsA("Model") then local humanoid = model:FindFirstChildOfClass("Humanoid") if humanoid and humanoid.Health > 0 then local isPlayer = isPlayerCharacter(model) if (AimPlayers and isPlayer and model ~= LocalPlayer.Character) or (not AimPlayers and not isPlayer) then for _, part in ipairs(getAimParts(model)) do if part and part:IsA("BasePart") and isVisible(part) then local screenPos, onScreen = Camera:WorldToViewportPoint(part.Position) if onScreen then local dist = (Vector2.new(screenPos.X, screenPos.Y) - screenCenter).Magnitude if dist < shortestDist then shortestDist = dist closestPart = part end end end end end end end end return closestPart end -- =================== AIMLOCK LOOP =================== RunService.RenderStepped:Connect(function() if not AimLockEnabled then return end if not LockedPart or not LockedPart.Parent or not isVisible(LockedPart) or not LockedPart:IsA("BasePart") then LockedPart = findNewTarget() end if LockedPart then local humanoid = LockedPart.Parent:FindFirstChildOfClass("Humanoid") if humanoid then local aimPos = getPredictedPosition(LockedPart, humanoid) Camera.CFrame = CFrame.new(Camera.CFrame.Position, aimPos) end end end) -- =================== UI =================== local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AimlockUI" ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") ScreenGui.ResetOnSpawn = false -- AimLock Button local AimButton = Instance.new("TextButton") AimButton.Size = UDim2.new(0, 120, 0, 45) AimButton.Position = UDim2.new(0.75, 0, 0.6, 0) AimButton.BackgroundColor3 = Color3.fromRGB(30, 30, 30) AimButton.TextColor3 = Color3.fromRGB(255, 255, 255) AimButton.TextScaled = true AimButton.Text = "AimLock: OFF" AimButton.Parent = ScreenGui Instance.new("UICorner", AimButton).CornerRadius = UDim.new(0, 12) -- Predict Button local PredictButton = Instance.new("TextButton") PredictButton.Size = UDim2.new(0, 150, 0, 40) PredictButton.Position = UDim2.new(0.75, 0, 0.7, 0) PredictButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40) PredictButton.TextColor3 = Color3.fromRGB(255, 255, 255) PredictButton.TextScaled = true PredictButton.Text = "Prediction: OFF" PredictButton.Parent = ScreenGui Instance.new("UICorner", PredictButton).CornerRadius = UDim.new(0, 10) -- NPC / Player Mode Button local ModeButton = Instance.new("TextButton") ModeButton.Size = UDim2.new(0, 170, 0, 40) ModeButton.Position = UDim2.new(0.75, 0, 0.78, 0) ModeButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60) ModeButton.TextColor3 = Color3.fromRGB(255, 255, 255) ModeButton.TextScaled = true ModeButton.Text = "Target Mode: NPC" ModeButton.Parent = ScreenGui Instance.new("UICorner", ModeButton).CornerRadius = UDim.new(0, 10) -- Settings Toggle Button local SettingsToggleButton = Instance.new("TextButton") SettingsToggleButton.Size = UDim2.new(0, 150, 0, 40) SettingsToggleButton.Position = UDim2.new(0.75, 0, 0.86, 0) SettingsToggleButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50) SettingsToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) SettingsToggleButton.TextScaled = true SettingsToggleButton.Text = "Settings: OFF" SettingsToggleButton.Parent = ScreenGui Instance.new("UICorner", SettingsToggleButton).CornerRadius = UDim.new(0, 10) -- Settings Frame local SettingsFrame = Instance.new("Frame") SettingsFrame.Size = UDim2.new(0, 240, 0, 140) SettingsFrame.Position = UDim2.new(0.5, -120, 0.2, 0) SettingsFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 25) SettingsFrame.Visible = false SettingsFrame.Parent = ScreenGui Instance.new("UICorner", SettingsFrame).CornerRadius = UDim.new(0, 14) -- Title local Title = Instance.new("TextLabel") Title.Size = UDim2.new(1, 0, 0, 30) Title.BackgroundTransparency = 1 Title.Text = "Prediction Settings" Title.TextColor3 = Color3.fromRGB(255, 255, 255) Title.TextScaled = true Title.Font = Enum.Font.SourceSansBold Title.Parent = SettingsFrame -- Bullet Speed Label local BulletLabel = Instance.new("TextLabel") BulletLabel.Size = UDim2.new(1, -20, 0, 25) BulletLabel.Position = UDim2.new(0, 10, 0, 40) BulletLabel.BackgroundTransparency = 1 BulletLabel.TextColor3 = Color3.fromRGB(200, 200, 200) BulletLabel.TextScaled = true BulletLabel.Text = "Bullet Speed: " .. Settings.BulletSpeed BulletLabel.Parent = SettingsFrame -- Bullet Speed Slider local BulletSliderBG = Instance.new("Frame") BulletSliderBG.Size = UDim2.new(1, -20, 0, 10) BulletSliderBG.Position = UDim2.new(0, 10, 0, 70) BulletSliderBG.BackgroundColor3 = Color3.fromRGB(60, 60, 60) BulletSliderBG.Parent = SettingsFrame local BulletSlider = Instance.new("Frame") BulletSlider.Size = UDim2.new(0.5, 0, 1, 0) BulletSlider.BackgroundColor3 = Color3.fromRGB(0, 170, 255) BulletSlider.Parent = BulletSliderBG -- =================== UI LOGIC =================== AimButton.MouseButton1Click:Connect(function() AimLockEnabled = not AimLockEnabled AimButton.Text = AimLockEnabled and "AimLock: ON" or "AimLock: OFF" AimButton.BackgroundColor3 = AimLockEnabled and Color3.fromRGB(0, 170, 0) or Color3.fromRGB(30, 30, 30) if not AimLockEnabled then LockedPart = nil end end) PredictButton.MouseButton1Click:Connect(function() PredictEnabled = not PredictEnabled PredictButton.Text = PredictEnabled and "Prediction: ON" or "Prediction: OFF" PredictButton.BackgroundColor3 = PredictEnabled and Color3.fromRGB(0, 140, 255) or Color3.fromRGB(40, 40, 40) end) ModeButton.MouseButton1Click:Connect(function() AimPlayers = not AimPlayers ModeButton.Text = AimPlayers and "Target Mode: PLAYER" or "Target Mode: NPC" ModeButton.BackgroundColor3 = AimPlayers and Color3.fromRGB(255, 100, 100) or Color3.fromRGB(60, 60, 60) LockedPart = nil end) SettingsToggleButton.MouseButton1Click:Connect(function() SettingsFrame.Visible = not SettingsFrame.Visible SettingsToggleButton.Text = SettingsFrame.Visible and "Settings: ON" or "Settings: OFF" SettingsToggleButton.BackgroundColor3 = SettingsFrame.Visible and Color3.fromRGB(0, 140, 255) or Color3.fromRGB(50, 50, 50) end) -- =================== DRAG UI (EXCEPT SLIDER) =================== local function makeDraggable(frame, blockedObjects) local dragging = false local dragInput, dragStart, startPos frame.InputBegan:Connect(function(input) if dragging then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then if blockedObjects then for _, obj in ipairs(blockedObjects) do if input.Target:IsDescendantOf(obj) then return end end end dragging = true dragInput = input dragStart = input.Position startPos = frame.Position end end) frame.InputEnded:Connect(function(input) if input == dragInput then dragging = false dragInput = nil end end) UserInputService.InputChanged:Connect(function(input) if dragging and input == dragInput then local delta = input.Position - dragStart frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) end makeDraggable(AimButton) makeDraggable(PredictButton) makeDraggable(ModeButton) makeDraggable(SettingsToggleButton) makeDraggable(SettingsFrame, {BulletSliderBG, BulletSlider}) -- =================== SLIDER LOGIC =================== local function makeSlider(sliderBG, sliderFill, minValue, maxValue, callback) local dragging = false local dragInput sliderBG.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragInput = input end end) sliderBG.InputEnded:Connect(function(input) if input == dragInput then dragging = false dragInput = nil end end) UserInputService.InputChanged:Connect(function(input) if dragging and input == dragInput then local x = math.clamp( (input.Position.X - sliderBG.AbsolutePosition.X) / sliderBG.AbsoluteSize.X, 0, 1 ) sliderFill.Size = UDim2.new(x, 0, 1, 0) local value = minValue + (maxValue - minValue) * x callback(value) end end) end makeSlider(BulletSliderBG, BulletSlider, 50, 1200, function(value) Settings.BulletSpeed = math.floor(value) BulletLabel.Text = "Bullet Speed: " .. Settings.BulletSpeed end)