Raycast not detecting (Probably not inversed)

I am trying to basically make bullet hit by getting the players heads cframe and using the look vector as the direction. However the ray seems to always not show. I am using a view model and this was my first though, that the player was simply being horizontal like this

This ended up being true with some testing so I just wrote some code that basically finds the degree difference then applies it (from the view model)

image

Logging the direction and position of the head seems to be returning values that would make sense for a raycast for it to collide with the ground however even with the else statement running as shown, the ray seems to never collide. I immediately thought the ray was inverted some how. However trying to shoot in to the sky in a sense yielded no results either.

local playerCount = {}

game.Players.PlayerAdded:Connect(function(plr)
	playerCount[plr.Name] = {0, os.clock()}
end)

game.Players.PlayerAdded:Connect(function(plr)
	playerCount[plr.Name] = nil
end)

game:GetService("ReplicatedStorage").RemoteEvents.Shot.OnServerEvent:Connect(function(plr)
	playerCount[plr.Name][1] += 1
	if os.clock() - playerCount[plr.Name][2] < 0.00001 then
		print("hacking")
	else
		local char = plr.Character or plr.CharacterAdded:Wait()
		local raycastParams = RaycastParams.new()
		raycastParams.FilterDescendantsInstances = {char}
		raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
		local ray = workspace:Raycast(char.Head.Position, char.Head.CFrame.LookVector * math.huge, raycastParams)
		--Gets run
		if ray then
			print(ray.Instance) --Never prints
		end
	end 
	playerCount[plr.Name][2] = os.clock()
end)
1 Like

im having the same issue any fixes?

EDIT: I asked a friend and he told me they patched it where it would default the length to 5000. Now it has to be below the far of 5000 studs explicitly - @Razor_IB

1 Like