Ra
Ra
local SilentAimSettings = {
Enabled = false,
TeamCheck = false,
VisibleCheck = false,
TargetPart = "HumanoidRootPart",
SilentAimMethod = "Raycast",
FOVRadius = 130,
FOVVisible = false,
ShowSilentAimTarget = false,
MouseHitPrediction = false,
MouseHitPredictionAmount = 0.165,
HitChance = 100
}
-- variables
getgenv().SilentAimSettings = Settings
local MainFileName = "UniversalSilentAim"
local SelectedFile, FileToSave = "", ""
local ExpectedArguments = {
FindPartOnRayWithIgnoreList = {
ArgCountRequired = 3,
Args = {
"Instance", "Ray", "table", "boolean", "boolean"
}
},
FindPartOnRayWithWhitelist = {
ArgCountRequired = 3,
Args = {
"Instance", "Ray", "table", "boolean"
}
},
FindPartOnRay = {
ArgCountRequired = 2,
Args = {
"Instance", "Ray", "Instance", "boolean", "boolean"
}
},
Raycast = {
ArgCountRequired = 3,
Args = {
"Instance", "Vector3", "Vector3", "RaycastParams"
}
}
}
function CalculateChance(Percentage)
-- // Floor the percentage
Percentage = math.floor(Percentage)
-- // Return
return chance <= Percentage / 100
end
--[[file handling]] do
if not isfolder(MainFileName) then
makefolder(MainFileName);
end
-- functions
local function GetFiles() -- credits to the linoria lib for this function,
listfiles returns the files full path and its annoying
local out = {}
for i = 1, #Files do
local file = Files[i]
if file:sub(-4) == '.lua' then
-- i hate this but it has to be done ...
return out
end
Main:AddToggle("aim_Enabled", {Text =
"Enabled"}):AddKeyPicker("aim_Enabled_KeyPicker", {Default = "RightAlt",
SyncToggleState = true, Mode = "Toggle", Text = "Enabled", NoUI = false});
Options.aim_Enabled_KeyPicker:OnClick(function()
SilentAimSettings.Enabled = not SilentAimSettings.Enabled
Toggles.aim_Enabled.Value = SilentAimSettings.Enabled
Toggles.aim_Enabled:SetValue(SilentAimSettings.Enabled)
mouse_box.Visible = SilentAimSettings.Enabled
end)
Compact = false,
})
Options.HitChance:OnChanged(function()
SilentAimSettings.HitChance = Options.HitChance.Value
end)
end
Toggles.TeamCheck:SetValue(SilentAimSettings.TeamCheck)
Toggles.VisibleCheck:SetValue(SilentAimSettings.VisibleCheck)
Options.TargetPart:SetValue(SilentAimSettings.TargetPart)
Options.Method:SetValue(SilentAimSettings.SilentAimMethod)
Toggles.Visible:SetValue(SilentAimSettings.FOVVisible)
Options.Radius:SetValue(SilentAimSettings.FOVRadius)
Toggles.MousePosition:SetValue(SilentAimSettings.ShowSilentAimTarget)
Toggles.Prediction:SetValue(SilentAimSettings.MouseHitPrediction)
Options.Amount:SetValue(SilentAimSettings.MouseHitPredictionAmount)
Options.HitChance:SetValue(SilentAimSettings.HitChance)
end
end)
end
resume(create(function()
RenderStepped:Connect(function()
if Toggles.MousePosition.Value and Toggles.aim_Enabled.Value then
if getClosestPlayer() then
local Root = getClosestPlayer().Parent.PrimaryPart or
getClosestPlayer()
local RootToViewportPoint, IsOnScreen =
WorldToViewportPoint(Camera, Root.Position);
-- using PrimaryPart instead because if your Target Part is
"Random" it will flicker the square between the Target's Head and HumanoidRootPart
(its annoying)
mouse_box.Visible = IsOnScreen
mouse_box.Position = Vector2.new(RootToViewportPoint.X,
RootToViewportPoint.Y)
else
mouse_box.Visible = false
mouse_box.Position = Vector2.new()
end
end
if Toggles.Visible.Value then
fov_circle.Visible = Toggles.Visible.Value
fov_circle.Color = Options.Color.Value
fov_circle.Position = getMousePosition()
end
end)
end))
-- hooks
local oldNamecall
oldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(...)
local Method = getnamecallmethod()
local Arguments = {...}
local self = Arguments[1]
local chance = CalculateChance(SilentAimSettings.HitChance)
if Toggles.aim_Enabled.Value and self == workspace and not checkcaller() and
chance == true then
if Method == "FindPartOnRayWithIgnoreList" and Options.Method.Value ==
Method then
if ValidateArguments(Arguments,
ExpectedArguments.FindPartOnRayWithIgnoreList) then
local A_Ray = Arguments[2]
return oldNamecall(unpack(Arguments))
end
end
elseif Method == "FindPartOnRayWithWhitelist" and Options.Method.Value ==
Method then
if ValidateArguments(Arguments,
ExpectedArguments.FindPartOnRayWithWhitelist) then
local A_Ray = Arguments[2]
return oldNamecall(unpack(Arguments))
end
end
elseif (Method == "FindPartOnRay" or Method == "findPartOnRay") and
Options.Method.Value:lower() == Method:lower() then
if ValidateArguments(Arguments, ExpectedArguments.FindPartOnRay) then
local A_Ray = Arguments[2]
return oldNamecall(unpack(Arguments))
end
end
elseif Method == "Raycast" and Options.Method.Value == Method then
if ValidateArguments(Arguments, ExpectedArguments.Raycast) then
local A_Origin = Arguments[2]
return oldNamecall(unpack(Arguments))
end
end
end
end
return oldNamecall(...)
end))