I have this script:
player = game.Players.LocalPlayer mouse = player:GetMouse() char = player.Character while wait() do local dir = (mouse.Hit.Z - char.Torso.CFrame.Z) * 1000 local dir2 = (mouse.Hit.X - char.Torso.CFrame.X) * 1000 char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,Vector3.new(dir2,0,dir)) end
It is supposed to rotate the player to the direction the mouse is facing. It works, but, it is very glitchy(the player shakes a lot when you move). How would I make it smooth?
You can make the wait run in smaller increments with RunService using RenderStepped.
player = game.Players.LocalPlayer mouse = player:GetMouse() char = player.Character RS = game:GetService("RunService") while true do local dir = (mouse.Hit.Z - char.Torso.CFrame.Z) * 1000 local dir2 = (mouse.Hit.X - char.Torso.CFrame.X) * 1000 char.Torso.CFrame = CFrame.new(char.Torso.CFrame.p,Vector3.new(dir2,0,dir)) RS.RenderStepped:wait() end