I am making a script that makes the player face the direction their mouse is pointing to. However, when the player isn’t moving (the person isn’t pressing WASD), it will slowly inch towards whichever way the mouse is pointing. My script is as below:
local Player = game.Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local mouse = game.Players.LocalPlayer:GetMouse()
wait(5)
while character:FindFirstChild("Humanoid").Health > 0 do
wait()
character.LowerTorso.CFrame = CFrame.new(character.LowerTorso.Position, Vector3.new(mouse.Hit.p.X, character.LowerTorso.Position.Y, mouse.Hit.p.Z))
end