Hello everyone, I have a script that makes the player face the mouse:
mouse.TargetFilter = game.Workspace
game.ReplicatedStorage.Play.Event:Connect(function()
local character = Player.Character or Player.CharacterAdded:Wait()
while character:FindFirstChild("Humanoid").Health > 0 do
game:GetService("RunService").Stepped:Wait()
character.UpperTorso.CFrame = CFrame.new(character.UpperTorso.Position, Vector3.new(mouse.Hit.p.X, character.UpperTorso.Position.Y, mouse.Hit.p.Z))
end
end)
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.