Mouse.Hit blacklist does not work

Hello everyone, I have a script that makes the player face the mouse:

mouse.TargetFilter = game.Workspace
	local character = Player.Character or Player.CharacterAdded:Wait()
	while character:FindFirstChild("Humanoid").Health > 0 do
		character.UpperTorso.CFrame =,, character.UpperTorso.Position.Y, mouse.Hit.p.Z))

However, I don’t want it to interfere with hitboxes, so I added

mouse.TargetFilter = game.Workspace

There is terrain under it, so it should work fine.
However, it doesn’t. Below is a video of what happens:
Also, if I remove the TargetFilter code, it works fine apart from hitboxes interfering with it.

1 Like

mouse.TargetFilter = game.Workspace would filter the ‘Workspace’ container and every physical instance contained within it (effectively blacklisting the entire 3D environment). If you want to filter hitboxes specifically I’d recommend grouping them together inside a single folder and blacklisting that instead, i.e;
mouse.TargetFilter = hitboxFolder