- --Made by DarkFunder
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local mouse = LocalPlayer:GetMouse()
- local Camera = workspace.CurrentCamera
- local Debris = game:GetService("Debris")
- local UserInputService = game:GetService("UserInputService")
- local target = false
- local RunService = game:GetService("RunService")
- local features = {
- silentaim = true;
- fov = 500;
- }
- function getnearest()
- local nearestmagnitude = math.huge
- local nearestenemy = nil
- local vector = nil
- for i,v in next, Players:GetChildren() do
- if v ~= Players.LocalPlayer then
- if v.Character and v.Character:FindFirstChild("HumanoidRootPart") and v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 then
- local vector, onScreen = Camera:WorldToScreenPoint(v.Character["HumanoidRootPart"].Position)
- if onScreen then
- local ray = Ray.new(
- Camera.CFrame.p,
- (v.Character["Head"].Position-Camera.CFrame.p).unit*500
- )
- local ignore = {
- LocalPlayer.Character,
- }
- local hit,position,normal=workspace:FindPartOnRayWithIgnoreList(ray,ignore)
- if hit and hit:FindFirstAncestorOfClass("Model") and Players:FindFirstChild(hit:FindFirstAncestorOfClass("Model").Name)then
- local magnitude = (Vector2.new(mouse.X, mouse.Y) - Vector2.new(vector.X, vector.Y)).magnitude
- if magnitude < nearestmagnitude and magnitude <= features["fov"] then
- nearestenemy = v
- nearestmagnitude = magnitude
- end
- end
- end
- end
- end
- end
- return nearestenemy
- end
- local meta = getrawmetatable(game)
- setreadonly(meta, false)
- local oldNamecall = meta.__namecall
- meta.__namecall = newcclosure(function(...)
- local method = getnamecallmethod()
- local args = {...}
- if string.find(method,'Ray') then
- if target then
- args[2] = Ray.new(workspace.CurrentCamera.CFrame.Position, (target + Vector3.new(0,(workspace.CurrentCamera.CFrame.Position-target).Magnitude/500,0) - workspace.CurrentCamera.CFrame.Position).unit * 500)
- end
- end
- return oldNamecall(unpack(args))
- end)
- RunService:BindToRenderStep("silentaim",1,function()
- if UserInputService:IsMouseButtonPressed(0) and features["silentaim"] and Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChild("Humanoid") and Players.LocalPlayer.Character.Humanoid.Health > 0 then
- local enemy = getnearest()
- if enemy and enemy.Character and enemy.Character:FindFirstChild("Humanoid") and enemy.Character.Humanoid.Health > 0 then
- local vector, onScreen = Camera:WorldToScreenPoint(enemy.Character["Head"].Position)
- local magnitude = (Vector2.new(mouse.X, mouse.Y) - Vector2.new(vector.X, vector.Y)).magnitude
- target = workspace[enemy.Name]["Head"].Position
- end
- else
- target = nil
- end
- end)