Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local getclosestPlayer = function() -- Checks the closest player based on Hypotenuse.
- local plrs, v = safe.Players:GetPlayers()
- local maxdist = 75
- local dist = math.huge
- local plr = "none"
- for i = 1, #plrs do
- v = plrs[i]
- if v ~= safe.Players.LocalPlayer then
- if v.Character then
- if v.TeamColor ~= safe.Players.LocalPlayer.TeamColor and teamcheck then
- local hpos = wtos(v.Character.Head.Position)
- local idist = distFromCenter(hpos.X, hpos.Y)
- if idist < dist and idist < _G.maxdistfromcross then
- dist = idist
- plr = v
- end
- elseif not teamcheck then
- local hpos = wtos(v.Character.Head.Position)
- local idist = distFromCenter(hpos.X, hpos.Y)
- if idist < dist and idist < _G.maxdistfromcross then
- dist = idist
- plr = v
- end
- end
- end
- end
- end
- return plr, dist
- end
- local AimAt = function(x, y)
- local vps = cam.ViewportSize
- local vpsx = vps.X
- local vpsy = vps.Y
- local screencenterx = vpsx/2
- local screencentery = vpsy/2
- local aimspeed = 5
- local aimatx
- local aimaty
- if x ~= 0 then
- if x > screencenterx then
- aimatx = -(screencenterx - x)
- aimatx = aimatx/aimspeed
- if aimatx + screencenterx > screencenterx * 2 then
- aimatx = 0
- end
- end
- if x < screencenterx then
- aimatx = x - screencenterx
- aimatx = aimatx/aimspeed
- if aimatx + screencenterx < 0 then
- aimatx = 0
- end
- end
- end
- if y ~= 0 then
- if y > screencentery then
- aimaty = -(screencentery - y)
- aimaty = aimaty/aimspeed
- if aimaty + screencentery > screencentery * 2 then
- aimaty = 0
- end
- end
- if y < screencentery then
- aimaty = y - screencentery
- aimaty = aimaty/aimspeed
- if aimaty + screencentery < 0 then
- aimaty = 0
- end
- end
- end
- return aimatx, aimaty
- end
- local MouseTests = function()
- local player = safe.Players.LocalPlayer
- local mouse = player:GetMouse()
- local screensizex = mouse.ViewSizeX
- local screensizey = mouse.ViewSizeY
- local midx = screensizex/2
- local midy = screensizey/2
- local mousex = mouse.X
- local mousey = mouse.Y
- local moveamountx = midx - mousex
- local moveamounty = midy - mousey
- movethemouse(moveamountx, moveamounty)
- local camera = safe.Workspace.Camera
- local newmousex = safe.Players.LocalPlayer:GetMouse().X
- local newmousey = safe.Players.LocalPlayer:GetMouse().Y
- local closestplayer = getclosestPlayer()
- if player.Character.Humanoid.Health > 0 then
- if closestplayer ~= "none" then
- if inlos(closestplayer.Character.Head.Position, closestplayer.Character) and visiblecheck then
- local closesthead = closestplayer.Character.Head
- local p = camera:WorldToScreenPoint(closesthead.Position)
- local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
- movethemouse(xdistancetohead, ydistancetohead)
- if autoshoot then
- movethemouse(xdistancetohead, ydistancetohead)
- wait(1)
- Input.LeftClick(MOUSE_DOWN)
- wait()
- end
- elseif not visiblecheck then
- local closesthead = closestplayer.Character.Head
- local p = camera:WorldToScreenPoint(closesthead.Position)
- local xdistancetohead, ydistancetohead = AimAt(p.X + _G.xaimoffset, p.Y + 32)
- movethemouse(xdistancetohead, ydistancetohead)
- end
- end
- end
- end
- game:GetService('RunService').Stepped:connect(function()
- if aimbotting then
- --MouseTests()
- end
- end)
- local plr = safe.Players.LocalPlayer
- local mouse = plr:GetMouse()
- print("Aimbot Loaded!")
- MB2Held = false
- function onKeyPress(inputObject,gameProcessed)
- if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
- MB2Held = true
- while MB2Held do
- if aimbotting then
- MouseTests()
- end
- wait()
- end
- end
- end
- function onKeyRelease(inputObject,gameProcessed)
- if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
- MB2Held = false
- end
- end
- game:GetService("UserInputService").InputBegan:connect(onKeyPress)
- game:GetService("UserInputService").InputEnded:connect(onKeyRelease)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement