Rotate a part depending on camera orientation?

I want to rotate something depending on where the camera is looking.
like how the normal Roblox character turns when you press wsad

Im working on a custom character controller and idk how i would do this.

Maybe this? the S movement kinda glitchy by the way.

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
camera.CameraType = Enum.CameraType.Scriptable

game:GetService('RunService').RenderStepped:Connect(function() 
	camera.CFrame = character:GetPrimaryPartCFrame()
end)

You can get the CFrame lookat from the workspace.CurrentCamera and multiply with a new Angles CFrame depending on which side you want it to be rotated to