Sometimes raycast does not hit target

so sometimes, raycasts does not hit a player. only in some specific areas.
here is a clip of that happening:
https://streamable.com/7mby4b
on the output you can see the part that it is hitting.
I want the raycast to hit the target most of the time
(I’m using runservice to move the frame of the projectile while using raycast to check hits)

What’s your code? Without the code, it’s impossible for us to determine the issue.

while true do
	dt = RunService.Heartbeat:Wait()
	--print(dt)
	inUse = projectiles.InUse:GetChildren()
	blackList = projectiles.InUse:GetChildren()
	for _, v in pairs(character:GetDescendants()) do
		if v:IsA("BasePart") then
			table.insert(blackList, v)
		end
		if v:IsA("Model") then
			for _, i in pairs(v:GetChildren()) do
				if v:IsA("BasePart") then
					table.insert(blackList, v)
				end
			end
		end
	end
	
	curTime = os.clock()
	
	for _, v in pairs(inUse) do
		--print(v.Name)
		velocity = v:FindFirstChild("Velocity")
		plr = v:FindFirstChild("Player").Value
		damage = v:FindFirstChild("Damage").Value
		passcode = v:FindFirstChild("Code").Value
		prevCFrame = v:FindFirstChild("prevCFrame").Value
		
		if plr == localPlayer then
			raycastParams.FilterDescendantsInstances = blackList
			local raycastResult = workspace:Raycast(prevCFrame.Position, (v.CFrame + v.CFrame.LookVector * (velocity.Value*dt)).Position, raycastParams)

			if raycastResult then
				print(raycastResult.Instance.Name)
				if raycastResult.Instance:IsA("BasePart") then
					x = raycastResult.Instance.Parent
					if x:IsA("Model") then
						hum = x:FindFirstChild("Humanoid")
						if hum and hum ~= character.Humanoid then
							hit:FireServer(passcode, damage, hum)
							v.CFrame = CFrame.new(raycastResult.Position)
							v.CFrame = CFrame.new(10e9, 0, 0)
							v.Parent = projectiles.Saved
							continue
							
						else
							hum = x:FindFirstChild("Humanoid")
							if hum and hum ~= character.Humanoid then
								hit:FireServer(passcode, damage, hum)
								v.CFrame = CFrame.new(raycastResult.Position)
								v.CFrame = CFrame.new(10e9, 0, 0)
								v.Parent = projectiles.Saved
								continue
							end
						end
					end
				end
				v.CFrame = CFrame.new(raycastResult.Position)
				v.CFrame = CFrame.new(10e9, 0, 0)
				v.Parent = projectiles.Saved
				continue
			end
		end
		
		if curTime - passcode >= 5 then
			v.CFrame = CFrame.new(10e9, 0, 0)
			v.Parent = projectiles.Saved
			continue
		end
		
		prevCFrame = v.CFrame
		v.CFrame += v.CFrame.LookVector * (velocity.Value*dt)
		--print(v.Position)
	end
end

it is probobly a mess, but this is the section that deals with moving as well as the raycasting part. (local script)

This won’t answer your question, but you don’t have to use the RunService to move your projectiles. You could use the TweenService to do that more easily.

First of all, I would recommend to use the CollectionService for handling projectiles. This way, you do not need to use a ‘while true do’ loop (code smell).

This vector does not make sense to me. It should be a directional vector, which means that it is not dependent of its origin, so you should not add it to its starting position. What you probably meant to write was: v.CFrame.LookVector * velocity.Value * dt.

doesnt raycast take in two position agruments? so I’m shooting the ray from the previous point to the next

Yes, but the second argument is only a direction. You added the starting position to the direction.