local Players = game:GetService("Players") local WorkspaceService = game:GetService("Workspace") local LocalPlayer = Players.LocalPlayer local Separator = string.rep("=", 60) local LogLimit = 50 local LogCount = 0 warn("\n" .. Separator) warn(" RAYCAST DEBUGGER") warn(" Logging next " .. LogLimit .. " raycasts from your character") warn(Separator .. "\n") local function GetCallerInfo() local Info = debug.info(4, "sln") if Info then return tostring(Info) end return "Unknown" end local function FormatVector(Vec) if typeof(Vec) ~= "Vector3" then return tostring(Vec) end return string.format("(%.1f, %.1f, %.1f)", Vec.X, Vec.Y, Vec.Z) end local OldNamecall OldNamecall = hookmetamethod(game, "__namecall", newcclosure(function(Self, ...) local Method = getnamecallmethod() if Method == "Raycast" and Self == WorkspaceService then local Origin, Direction, Params = ... if typeof(Origin) == "Vector3" and typeof(Direction) == "Vector3" then local Character = LocalPlayer.Character local Head = Character and Character:FindFirstChild("Head") local HeadDist = Head and (Origin - Head.Position).Magnitude or -1 if HeadDist < 10 or HeadDist == -1 then LogCount = LogCount + 1 if LogCount <= LogLimit then local CollisionGroup = "Default" if typeof(Params) == "RaycastParams" then CollisionGroup = Params.CollisionGroup or "Default" end warn(string.rep("-", 40)) warn(" Raycast #" .. LogCount) warn(string.rep("-", 40)) print(" Origin: " .. FormatVector(Origin)) print(" Direction: " .. FormatVector(Direction)) print(" Magnitude: " .. string.format("%.1f", Direction.Magnitude)) print(" HeadDist: " .. string.format("%.2f", HeadDist)) print(" Collision: " .. CollisionGroup) print(" Caller: " .. GetCallerInfo()) local Result = OldNamecall(Self, Origin, Direction, Params) if Result then print(" Hit: " .. Result.Instance:GetFullName()) print(" HitPos: " .. FormatVector(Result.Position)) local HumanoidModel = Result.Instance.Parent local Humanoid = HumanoidModel and HumanoidModel:FindFirstChildOfClass("Humanoid") if Humanoid then print(" Humanoid: " .. HumanoidModel.Name .. " (HP: " .. Humanoid.Health .. ")") end else print(" Hit: nil") end print("") if LogCount >= LogLimit then warn(Separator) warn(" Reached " .. LogLimit .. " logs. Hook remains active silently.") warn(Separator) end setnamecallmethod(Method) return Result end end end end if Method == "FindPartOnRayWithIgnoreList" and Self == WorkspaceService then local Ray, IgnoreList = ... local Character = LocalPlayer.Character local Head = Character and Character:FindFirstChild("Head") local HeadDist = Head and (Ray.Origin - Head.Position).Magnitude or -1 if HeadDist < 10 or HeadDist == -1 then LogCount = LogCount + 1 if LogCount <= LogLimit then warn(string.rep("-", 40)) warn(" FindPartOnRay #" .. LogCount .. " (Legacy)") warn(string.rep("-", 40)) print(" Origin: " .. FormatVector(Ray.Origin)) print(" Direction: " .. FormatVector(Ray.Direction)) print(" Magnitude: " .. string.format("%.1f", Ray.Direction.Magnitude)) print(" HeadDist: " .. string.format("%.2f", HeadDist)) print(" IgnoreList: " .. #IgnoreList .. " items") print(" Caller: " .. GetCallerInfo()) print("") end end end setnamecallmethod(Method) return OldNamecall(Self, ...) end)) warn("OK")