Just for testing try putting the code in a while loop instead of using Runservice.RenderStepped, just to see how the character “reacts”
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
while true do
wait(.5)
local Character = Player.Character
Character.HumanoidRootPart.CFrame = CFrame.new(Character.HumanoidRootPart.CFrame.Position, Vector3.new(Mouse.Hit.Position.X, Character.HumanoidRootPart.CFrame.Position.Y, Mouse.Hit.Position.Z))
end
(Also i would recommend using heartbeat or stepped instead of render stepped, in this case)
Player = Players.LocalPlayer
Mouse = Player:GetMouse()
Char = Player.Character
if not Char then
Player.CharacterAdded:Wait()
Char = Player.Character
end
RootPart = Char:WaitForChild('HumanoidRootPart')
local rs = game:GetService("RunService")
local speed = 8 -- change on how fast you want it to be
rs.Heartbeat:Connect(function(HB)
local MousePos = Mouse.Hit.p
local lookVector = Vector3.new(MousePos.X,RootPart.CFrame.Y,MousePos.Z)
RootPart.CFrame = RootPart.CFrame:Lerp(CFrame.new(RootPart.CFrame.p,lookVector),HB * speed)
end)```
I don’t use lerp much, but from my understanding you’re supposed to feed it a percentage where 0 is the origin and 1 is the destination.
I think this is what you’re looking for:
RunService.Stepped:connect(function()
local MousePos = Mouse.Hit.p
local lookVector = Vector3.new(MousePos.X,RootPart.CFrame.Y,MousePos.Z)
local target = CFrame.new(RootPart.CFrame.p,lookVector)
RootPart.CFrame = RootPart.CFrame:lerp(target,.05)
end)
This code (in theory) gets you closer and closer to the desired CFrame by 5% each time.
It won’t actually technically reach the desired CFrame (in theory) but it’ll be so close that you can’t tell the difference.
It depends on what you want to go up and down. If you want the character’s head to look up and down, you can modify the C0 property of the Head’s Neck joint.