Here's my current code:
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoidrootpart = character.HumanoidRootPart
local Mouse = player:GetMouse()
local Camera = workspace.CurrentCamera
local Debris = game:GetService("Debris")
local lookvector = Camera.CFrame.LookVector
UIS.InputBegan:connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.R then
local BodyGyro = Instance.new("BodyGyro")
BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
BodyGyro.D = 2e3
BodyGyro.P = 9e9
BodyGyro.Parent = humanoidrootpart
BodyGyro.CFrame = CFrame.new(humanoidrootpart.Position, (humanoidrootpart.Position + Camera.CFrame.LookVector))
Debris:AddItem(BodyGyro, 1)
end
end)
This successfully rotates to the camera's lookvector, however I wish to disregard the y vector when rotating so the character doesn't rotate up or down.
