Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Dynamic Aimbot
- -- Created by ChickenBagelz
- local suc, err = pcall(function()
- if not _G.CurrentVersion then
- _G.CurrentVersion = 0
- end
- _G.CurrentVersion = _G.CurrentVersion + 1
- local LastVersion = _G.CurrentVersion
- local function IsUpdated()
- return LastVersion == _G.CurrentVersion
- end
- local function GetRayClosestPoint(ray, point)
- local a, b = ray.Origin - point, ray.Direction
- local v = a - ((a:Dot(b)) / (b:Dot(b))) * b
- return point + v
- end
- local Players = game:GetService("Players")
- local Run = game:GetService("RunService")
- local UIS = game:GetService("UserInputService")
- local plr = Players.LocalPlayer
- local Mouse = plr:GetMouse()
- local Camera = workspace.CurrentCamera
- local Gui = Instance.new("ScreenGui")
- local keybind2
- Gui.Name = "Chat"
- Gui.Parent = game.CoreGui
- local Msg = Instance.new("TextLabel")
- Msg.Text = "Press any key to set as keybind to toggle Aimbot."
- Msg.TextScaled = true
- Msg.TextWrapped = true
- Msg.Size = UDim2.new(0.1, 0, 0.05, 0)
- Msg.BackgroundTransparency = 1
- Msg.TextColor3 = Color3.new(1, 1, 1)
- Msg.TextStrokeColor3 = Color3.new()
- Msg.TextStrokeTransparency = 0
- Msg.Position = UDim2.new(0.45, 0, 0.475, 0)
- Msg.Parent = Gui
- local lerpto = CFrame.new()
- local limb = "HumanoidRootPart"
- UIS.InputBegan:Connect(function(input)
- if (not keybind) and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode and IsUpdated() then
- keybind = input.KeyCode
- Msg.Text = "Toggle keybind set to "..keybind.Name.."."
- wait(3)
- Msg.Text = "Now press any key to toggle which limb to aim at."
- elseif keybind and (not keybind2) and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode and IsUpdated() then
- keybind2 = input.KeyCode
- Msg.Text = "Switch limbs set to "..keybind2.Name.."."
- wait(3)
- Msg:Destroy()
- elseif keybind2 and UIS:IsKeyDown(keybind2) and IsUpdated() then
- limb = (limb == "Head" and "HumanoidRootPart" or "Head")
- elseif keybind and UIS:IsKeyDown(keybind) and IsUpdated() then
- if islooking then
- islooking = false
- else
- local cd, cp
- for i = 1, 2 do
- if i == 2 then
- cd = nil; cp = nil
- end
- local ray = Ray.new(Mouse.UnitRay.Origin, Mouse.UnitRay.Direction * 10000)
- for _, v in pairs(Players:GetPlayers()) do
- local c = v.Character
- if v ~= plr and c and c.PrimaryPart and c:FindFirstChild("Humanoid") and c.Humanoid.Health > 0 and ((not v.Team) or (not plr.Team) or plr.Team ~= v.Team) then
- local prim = c.PrimaryPart.Position
- local pp = GetRayClosestPoint(ray, prim)
- local dist = (pp - prim).magnitude
- if (not cp) or dist < cd then
- cp = v
- cd = dist
- end
- end
- end
- if cp and cd then
- lerpto = CFrame.new(Camera.CFrame.p, cp.Character[limb].Position)
- end
- end
- if cp and cd and lerpto then
- print("looking at "..cp.Name)
- islooking = true
- local alpha = 0.2
- while islooking and IsUpdated() and cp and cp.Character and cp.Character.PrimaryPart and cp.Character:FindFirstChild("Humanoid") and cp.Character.Humanoid.Health > 0 do
- Camera.CFrame = Camera.CFrame:lerp(CFrame.new(Camera.CFrame.p, cp.Character[limb].Position), alpha)
- alpha = math.min(alpha + 0.01, 1)
- Run.RenderStepped:Wait()
- end
- print("stopped")
- end
- end
- end
- end)
- print("Successfully executed Aimbot by ChickenBagelz: "..LastVersion)
- end)
- if not suc then
- print(err)
- end
Advertisement
Add Comment
Please, Sign In to add comment