local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
getgenv().Config = {
Enabled = true,
MagicBullet = true,
AimPart = "Head",
HitChance = 100,
FOV = 360,
VisibleCheck = true,
ShowFOV = true,
FOVColor = Color3.fromRGB(255, 255, 255)
}
local FOVCircle = Drawing.new("Circle")
FOVCircle.Thickness = 1
FOVCircle.NumSides = 100
FOVCircle.Radius = getgenv().Config.FOV
FOVCircle.Filled = false
FOVCircle.Visible = getgenv().Config.ShowFOV
FOVCircle.Color = getgenv().Config.FOVColor
RunService.RenderStepped:Connect(function()
FOVCircle.Position = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
FOVCircle.Radius = (getgenv().Config.FOV >= 360) and 2000 or getgenv().Config.FOV
FOVCircle.Visible = getgenv().Config.ShowFOV
end)
local ModuleScript = ReplicatedStorage:WaitForChild("ModuleScript")
local GameCommonMethod = require(ModuleScript.GameCommonMethod)
local oldRaycast = GameCommonMethod.Raycast
local function validateTarget(model)
if not model or not model:IsA("Model") then return false end
local isRealPlayer = Players:FindFirstChild(model.Name)
if isRealPlayer and not model:GetAttribute("InGame") then
return false
end
local humanoid = model:FindFirstChildOfClass("Humanoid")
local head = model:FindFirstChild("Head")
if not humanoid or humanoid.Health <= 0 or not head then return false end
if head:FindFirstChild("TeamMate") then return false end
local myTeam = LocalPlayer:GetAttribute("TeamNum")
local targetTeam = model:GetAttribute("TeamNum")
if targetTeam and myTeam and targetTeam == myTeam then return false end
return true
end
local function isVisible(target, origin)
local targetPart = target:FindFirstChild(getgenv().Config.AimPart)
if not targetPart then return false end
local rayParams = RaycastParams.new()
rayParams.FilterType = Enum.RaycastFilterType.Exclude
rayParams.FilterDescendantsInstances = {LocalPlayer.Character, target, workspace:FindFirstChild("Player")}
local direction = (targetPart.Position - origin)
local result = oldRaycast(origin, direction, rayParams)
return result == nil
end
local function getClosestTargetToCrosshair(origin)
local closest = nil
local shortestDistance = math.huge
local playerFolder = workspace:FindFirstChild("Player")
local centerScreen = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
if playerFolder then
for _, char in pairs(playerFolder:GetChildren()) do
if char.Name ~= LocalPlayer.Name and validateTarget(char) then
local targetPart = char:FindFirstChild(getgenv().Config.AimPart)
if targetPart then
local screenPos, onScreen = Camera:WorldToViewportPoint(targetPart.Position)
local distance = (Vector2.new(screenPos.X, screenPos.Y) - centerScreen).Magnitude
if getgenv().Config.FOV >= 360 or (onScreen and distance <= getgenv().Config.FOV) then
if getgenv().Config.VisibleCheck and not getgenv().Config.MagicBullet then
if not isVisible(char, origin) then continue end
end
if distance < shortestDistance then
closest = char
shortestDistance = distance
end
end
end
end
end
end
return closest
end
GameCommonMethod.Raycast = function(...)
local args = {...}
local origin, direction, params
if type(args[1]) == "table" then
origin, direction, params = args[2], args[3], args[4]
else
origin, direction, params = args[1], args[2], args[3]
end
if getgenv().Config.Enabled and not checkcaller() then
if math.random(1, 100) <= getgenv().Config.HitChance then
local target = getClosestTargetToCrosshair(origin)
if target then
local targetHead = target:FindFirstChild(getgenv().Config.AimPart)
if targetHead then
if getgenv().Config.MagicBullet then
local newOrigin = targetHead.Position + Vector3.new(0, 1, 0)
local newDirection = Vector3.new(0, -2, 0)
return oldRaycast(newOrigin, newDirection, params)
else
local silentDirection = (targetHead.Position - origin).Unit * direction.Magnitude
return oldRaycast(origin, silentDirection, params)
end
end
end
end
end
return oldRaycast(...)
end
Comments
No comments yet
Be the first to share your thoughts!