Raycast imprecise with voxel Game

Hello, I am trying to make a voxel game, at this stage I am creating the build system, I use Raycast but it is very inefficient (It reminds me of the counter strike recoil), here is the script and a video, thanks in advance

function setBlock(block)
	local rPar = RaycastParams.new()
	rPar.FilterType = Enum.RaycastFilterType.Exclude
	rPar.FilterDescendantsInstances = {chr, camera}
	
	local ray = workspace:Raycast(camera.CFrame.Position, (camera.CFrame.Position - mouse.Hit.Position).Unit * -100, rPar)
	
	if ray then
		if ray.Instance:IsA("BasePart") then
			ray.Instance.Color = Color3.new(1, 0, 0)
		end
	end
	
end
1 Like