-- [[ Services & Vars ]] --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInput = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local RootPart = Character:WaitForChild("HumanoidRootPart")
-- [[ Silent Aim Config ]] --
local SilentAim = {
Enabled = true,
HitPart = "Head",
FOV = {
Visible = true,
Transparency = 1,
Thickness = 1,
Radius = 150,
Color = Color3.fromRGB(255, 0, 0)
}
}
-- [[ Drawing ]] --
local FOVCircle = Drawing.new("Circle")
FOVCircle.Color = SilentAim.FOV.Color
FOVCircle.Thickness = SilentAim.FOV.Thickness
FOVCircle.Filled = false
FOVCircle.Transparency = SilentAim.FOV.Transparency
FOVCircle.Radius = SilentAim.FOV.Radius
-- [[ Gets Closest Player ]] --
local function GetClosestPlayer()
local ClosestDistance, ClosestPart = nil, nil
local MousePosition = UserInput:GetMouseLocation()
for _, Player in next, Players:GetPlayers() do
if Player ~= LocalPlayer and Player.Character then
local Character = Player.Character
local HitPart = Character:FindFirstChild(SilentAim.HitPart)
local Humanoid = Character:FindFirstChild("Humanoid")
if HitPart and Humanoid and Humanoid.Health > 0 then
local ScreenPosition, Visible =
workspace.CurrentCamera:WorldToScreenPoint(HitPart.Position)
if Visible then
local Distance = (MousePosition - Vector2.new(ScreenPosition.X,
ScreenPosition.Y)).Magnitude
if Distance <= SilentAim.FOV.Radius and (not ClosestDistance or
Distance < ClosestDistance) then
ClosestDistance, ClosestPart = Distance, HitPart
end
end
end
end
end
return ClosestPart
end
-- [[ The Silent Hook ]] --
local grm = getrawmetatable(game)
local index = grm.__index
setreadonly(grm, false)
grm.__index = function(self, Index)
if not checkcaller() and self == LocalPlayer:GetMouse() and SilentAim.Enabled
then
if Index == "Hit" or Index == "Target" then
local TargetPart = GetClosestPlayer()
if TargetPart then
return CFrame.new(TargetPart.Position)
end
end
end
return index(self, Index)
end
-- [[ FOV Circle Update ]] --
RunService.RenderStepped:Connect(function()
FOVCircle.Visible = SilentAim.FOV.Visible and SilentAim.Enabled
FOVCircle.Position = UserInput:GetMouseLocation()
FOVCircle.Radius = SilentAim.FOV.Radius
end)
local function FireShot()
local TargetPart = GetClosestPlayer()
if not TargetPart then
warn("No target found.")
return
end
local TargetHead = TargetPart
if not TargetHead then
warn("Target has no head.")
return
end
local ShotData = {
"Shoot",
{
{
{ Instance = TargetHead, Normal = Vector3.new(0.99, 0.1, -0.02),
Position = TargetHead.Position },
{ Instance = TargetHead, Normal = Vector3.new(0.99, 0.1, -0.02),
Position = TargetHead.Position },
{ Instance = TargetHead, Normal = Vector3.new(0.99, 0.1, -0.02),
Position = TargetHead.Position },
{ Instance = TargetHead, Normal = Vector3.new(0.99, 0.1, -0.02),
Position = TargetHead.Position },
{ Instance = TargetHead, Normal = Vector3.new(0.99, 0.1, -0.02),
Position = TargetHead.Position }
},
{
{ ThePart = TargetHead, TheOffset = CFrame.new() },
{ ThePart = TargetHead, TheOffset = CFrame.new() },
{ ThePart = TargetHead, TheOffset = CFrame.new() },
{ ThePart = TargetHead, TheOffset = CFrame.new() },
{ ThePart = TargetHead, TheOffset = CFrame.new() }
},
RootPart.Position,
RootPart.Position,
workspace:GetServerTimeNow()
}
}
local MainEvent = ReplicatedStorage:FindFirstChild("MainEvent")
if MainEvent then
MainEvent:FireServer(unpack(ShotData))
else
warn("MainEvent not found.")
end
end
RunService.Heartbeat:Connect(function()
if SilentAim.Enabled then
FireShot()
end
end)