Title pretty much explains it all. I would like my entire character model to face towards my cursor with out messing up the characters animations. I would only like this to affect the Y axis, meaning that my character should only turn left and right, not up or down. I will also be using R6 for this.
How would i do this? Help would be much appreciated!
Here is the code this is not FE but it should not be hard to make a FE one just put it in a local script in the client
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
game:GetService(“RunService”).RenderStepped:Connect(function()
local Character = Player.Character
Character:SetPrimaryPartCFrame(CFrame.new(Character.PrimaryPart.CFrame.Position, Vector3.new(Mouse.Hit.Position.X, Character.PrimaryPart.CFrame.Position.Y, Mouse.Hit.Position.Z)))
end)
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)