Basically at long ranges the raycast doesn’t work at all, sometimes it doesn’t even work at close range
Everything on the character IS ignored by the raycast as well so it can’t be colliding with it.
It starts at the head and ends at the mouse.Hit.Position area
If you need anymore info simply comment what you need
local event = game.ReplicatedStorage.SendMouse
event.OnServerEvent:Connect(function(plr, mouse, headP, char)
local RayOrigin = headP
local RayDirection = mouse
local raycastParamas = RaycastParams.new()
raycastParamas.FilterDescendantsInstances = {char, char:GetDescendants()}
raycastParamas.FilterType = Enum.RaycastFilterType.Blacklist
local RaycastResults = workspace:Raycast(RayOrigin, RayDirection, raycastParamas)
if RaycastResults then
print(RaycastResults.Instance)
local distance = (RayOrigin - RaycastResults.Position).Magnitude
local p = Instance.new("Part")
p.Anchored = true
p.CanCollide = false
p.Size = Vector3.new(0.1, 0.1, distance)
p.CFrame = CFrame.lookAt(RayOrigin, RayDirection)*CFrame.new(0, 0, -distance/2)
p.Parent = game.Workspace
wait(0.2)
p:Destroy()
end
end)
(i can’t send the video for some reason, but basically you have to be super close to a wall for the raycast to even activate)