0% found this document useful (0 votes)
5 views

message (8)

The document is a script for a Roblox game that implements a silent aim feature, allowing players to automatically target opponents' heads within a specified field of view. It includes configurations for the field of view circle and functions to identify the closest player and fire shots at them. The script utilizes various Roblox services to manage player input and rendering, ensuring the silent aim functionality operates smoothly during gameplay.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

message (8)

The document is a script for a Roblox game that implements a silent aim feature, allowing players to automatically target opponents' heads within a specified field of view. It includes configurations for the field of view circle and functions to identify the closest player and fire shots at them. The script utilizes various Roblox services to manage player input and rendering, ensuring the silent aim functionality operates smoothly during gameplay.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

-- [[ 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)

You might also like