RayCast issues at close distances

Try adding to the ignore list.

In both of your scripts, you have only ignored accessories.

if char:FindFirstChild("Humanoid") then
	ray.FilterDescendantsInstances = char.Humanoid:GetAccessories()
end

Instead, make a table that includes everything in the character.

raycastParams.FilterDescendantsInstances = {
     char:GetDescendants();
}

This will ignore accessories, body parts, and the tool equipped.