Whenever i run this it says "Ray Hit Nothing" I am trying to make it print what the camera is facing

camera = workspace.CurrentCamera
player = game.Players.LocalPlayer
character = game.Workspace:WaitForChild(player.Name)

local function Shoot(start, direction)
	local rayParams = RaycastParams.new()
	rayParams.FilterDescendantsInstances = {character}
	rayParams.FilterType = Enum.RaycastFilterType.Blacklist
	local ray = workspace:Raycast(start, direction, rayParams)
	if ray then
		print(ray.Instance)
	else
		print("Ray Hit Nothing")
	end
end

while true do
	Shoot(camera.CFrame.Position, camera.CFrame.LookVector)
	wait(1)
end

2 comments

0

Do you realize Player.Character is a thing:P

0

Yeah for me though I find it easier to use waitforchild player.name Is there I important reason to use player.character instead?