Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ## silent aimbot for ffa games written by aze#6678
- -- ## only works for protosmasher, undetectable by almost every game
- -- ## team dm aimbot coming soon!
- local getOurHead = function() -- make it dynamic so it works after we respawn
- if game:GetService("Players").LocalPlayer.Character.Head then -- if we're alive
- return game:GetService("Players").LocalPlayer.Character.Head.Position -- return the head position
- else
- return nil -- return nothing
- end
- end
- function getNearestCharacterToUs()
- local smallestPositionFound = math.huge -- log the smallest position to us found yet
- local nearestPlayerRightNow = nil -- we haven't found anything yet, so just set this to nil for now.
- for i, player in pairs(game:GetService("Players"):GetPlayers()) do -- get all players in the game and loop through them
- if player ~= game:GetService("Players").LocalPlayer then -- check if the player is not localplayer (if its not us)
- if player.Character then -- check if their character exists (or if they're dead, spectating or choosing loadout, or doing something else)
- local distanceFromUs = player:DistanceFromCharacter(getOurHead() or Vector3.new(0,0,0)) -- calculate distance from our head or 0, 0, 0 (if our head doesn't exist)
- if distanceFromUs < smallestPositionFound then -- if the player we found is closer than the closest player then
- smallestPositionFound = distanceFromUs -- log the position of the closest player
- nearestPlayerRightNow = player.Character -- log the character closest to us
- end
- end
- end
- end
- return nearestPlayerRightNow -- return the closest character to our character
- end
- -- so if we were to do print(getNearestCharacterToUs().Name)) it would print the name of the player that's closest to our character right now.
- -- we can get the position of the closest character using getNearestCharacterToUs.Position
- -- so, now we know the position of the closest character to us, we can start aiming at him.
- local camera = workspace.CurrentCamera
- function WorldToScreen(Position)
- return camera:WorldToScreenPoint(Position) -- voila! now we have the position that we want to move our mouse on.
- end
- local mouse = game:GetService("Players").LocalPlayer:GetMouse()
- local smoothness = 2
- local delay = 0.033
- function actuallyAim()
- if getNearestCharacterToUs().Head then -- see if the character's head exists first
- local aimAt = WorldToScreen(getNearestCharacterToUs().Head.Position) -- get the Vector2 coordinates of the target
- local mouseLocation = WorldToScreen(mouse.Hit.p)
- local incrementX, incrementY = (aimAt.X - mouseLocation.X) / smoothness, (aimAt.Y - mouseLocation.Y) / smoothness -- calculate the increments according to smoothness
- for i = 1, smoothness do -- hey, we already described this before!
- Input.MoveMouse(incrementX, incrementY) -- move the mouse 1/smoothness of the way
- wait (delay) -- or you can use game:GetService("RunService").RenderStepped:Wait() OR you can remove this line to make the aimbot snap instantly on your victims
- end
- end
- end
- local toggled = false
- local keybind = "g" -- customize the keybind to enable and disable the aimbot
- mouse.KeyDown:Connect(function(key)
- if key == keybind then
- if toggled then -- if its enabled then disable it
- toggled = false
- print "disabled silent aimbot!"
- else -- if its disabled enable it
- toggled = true
- print "enabled silent aimbot!"
- end
- end
- end)
- while wait (delay * smoothness) do -- very important part
- if toggled then -- if the aimbot is toggled, if it is
- actuallyAim() -- aim at the player
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement