I’m faced with a problem that I’ve already done thousands of searches but none of them helped me
Issue:
When my character is moving and there is a part behind him, the camera turns to the part, I don’t know how this happens and I think it has to do with my code
Maybe changing the method I’m using to rotate the HumanoidRootPart?
Code: (resumed)
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Root = character:WaitForChild("HumanoidRootPart")
local m = LocalPlayer:GetMouse()
RunService.RenderStepped:Connect(function()
local RootPos, MousePos = Root.Position, m.Hit.Position
Root.CFrame = CFrame.new(RootPos, Vector3.new(MousePos.X, RootPos.Y, MousePos.Z))
end)