Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local safe = setmetatable({}, {
- __index = function(_, k)
- return game:GetService(k)
- end
- })
- local movethemouse = mousemoverel or Input.MoveMouse --Mouse Move Function.
- local aimbotting = false -- Toggles.
- local autoshoot = false
- local teamcheck = true
- local vischeck = true
- local cam = safe.Workspace.CurrentCamera -- Current Camera
- local lp = safe.Players.LocalPlayer -- Local Player
- local lpc = safe.Players.LocalPlayer.Character -- Local Player Character
- local wtos = function(v) -- World To Screen
- return cam:WorldToScreenPoint(v)
- end
- local distFromCenter = function(x, y)
- local vps = cam.ViewportSize -- Get ViewPortSize.
- local vpsx = vps.X
- local vpsy = vps.Y
- local screencenterx = vpsx/2
- local screencentery = vpsy/2
- local xdist = (x - screencenterx) -- X Distance From Mid Screen.
- local ydist = (y - screencentery) -- Y Distance From Mid Screen.
- local Hypotenuse = math.sqrt(math.pow(xdist, 2) + math.pow(ydist, 2))
- return Hypotenuse
- end
- local function inlos(p, ...) -- In line of site?
- return #cam:GetPartsObscuringTarget({p}, {cam, lp.Character, ...}) == 0
- end
- local getclosestPlayer = function() -- Checks the closest player based on Hypotenuse.
- local plrs, v = safe.Players:GetPlayers()
- local maxdist = 75
- local dist = 9e99
- local plr = "none"
- for i = 1, #plrs do
- v = plrs[i]
- if v ~= safe.Players.LocalPlayer then
- if v.Character then
- if v.Team ~= safe.Players.LocalPlayer.Team then
- local hpos = wtos(v.Character.Head.Position)
- local idist = distFromCenter(hpos.X, hpos.Y)
- if idist < dist and idist < maxdist 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) then
- local closesthead = closestplayer.Character.Head
- local p = camera:WorldToScreenPoint(closesthead.Position)
- local xdistancetohead, ydistancetohead = AimAt(p.X - 25, 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()
- mouse.KeyDown:connect(function(key)
- if key == "t" then
- aimbotting = not aimbotting
- print("Aimbotting: " .. tostring(aimbotting))
- MouseTests()
- end
- if key == "o" then
- teamcheck = not teamcheck
- print("Team Check: " .. tostring(teamcheck))
- end
- end)
- print("Pixel 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