Flying System Help

Hello, I’m currently working on a flying system but I need help with something. As shown in this video when I fly the character doesn’t face head-first to the direction of the camera. Can anyone help me with this?

Here’s my current code

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local cam = workspace.CurrentCamera
local uis = game:GetService("UserInputService")
local rep = game:GetService("ReplicatedStorage")

local forwardAnim = char:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(script:WaitForChild("Animation"))
forwardAnim.Looped = true
local event = rep:WaitForChild("FlyingEvent")

local wPressed = false
local sPressed = false
local aPressed = false
local dPressed = false

local flying = false
uis.InputBegan:Connect(function(key, chat)
	if chat then return end
	if key.KeyCode == Enum.KeyCode.F then
		if flying then --Stop Flying
			event:FireServer("EndFlying")
			flying = false
			char.Animate.Disabled = false
			forwardAnim:Stop()
			
		else --Start Flying
			flying = true
			char.Animate.Disabled = true
			event:FireServer("BeginFlying")
			
			local bv = Instance.new("BodyVelocity", char.PrimaryPart)
			bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			bv.Velocity = Vector3.new(0,0,0)
			bv.Name = "FlightForce"
			
			repeat wait(0.1) until flying == false
			bv:Destroy()
		end
	end
	
	if key.KeyCode == Enum.KeyCode.W then
		wPressed = true
	elseif key.KeyCode == Enum.KeyCode.S then
		sPressed = true
	elseif key.KeyCode == Enum.KeyCode.A then
		aPressed = true
	elseif key.KeyCode == Enum.KeyCode.D then
		dPressed = true
	end
end)

uis.InputEnded:Connect(function(key)	
	if key.KeyCode == Enum.KeyCode.W then
		wPressed = false
	elseif key.KeyCode == Enum.KeyCode.S then
		sPressed = false
	elseif key.KeyCode == Enum.KeyCode.A then
		aPressed = false
	elseif key.KeyCode == Enum.KeyCode.D then
		dPressed = false
	end
end)

while wait() do
	if flying then
		char.PrimaryPart:FindFirstChild("FlightForce").Velocity = Vector3.new(0,0,0)
		forwardAnim:Stop()
		
		if wPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.LookVector * 100
			forwardAnim:Play()
		end
		if sPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.LookVector * -100
			forwardAnim:Play()
		end
		if aPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.RightVector * -100
			forwardAnim:Play()
		end
		if dPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.RightVector * 100
			forwardAnim:Play()
		end
	else
		wait(1)
	end
end

I believe a RenderStepped should solve this along with some math.

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local cam = workspace.CurrentCamera
local uis = game:GetService("UserInputService")
local rep = game:GetService("ReplicatedStorage")

local forwardAnim = char:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(script:WaitForChild("Animation"))
forwardAnim.Looped = true
local event = rep:WaitForChild("FlyingEvent")

local wPressed = false
local sPressed = false
local aPressed = false
local dPressed = false

local flying = false
uis.InputBegan:Connect(function(key, chat)
	if chat then return end
	if key.KeyCode == Enum.KeyCode.F then
		if flying then --Stop Flying
			event:FireServer("EndFlying")
			flying = false
			char.Animate.Disabled = false
			forwardAnim:Stop()
			
		else --Start Flying
			flying = true
			char.Animate.Disabled = true
			event:FireServer("BeginFlying")
			
			local bv = Instance.new("BodyVelocity", char.PrimaryPart)
			bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
			bv.Velocity = Vector3.new(0,0,0)
			bv.Name = "FlightForce"
			
			repeat wait(0.1) until flying == false
			bv:Destroy()
		end
	end
	
	if key.KeyCode == Enum.KeyCode.W then
		wPressed = true
	elseif key.KeyCode == Enum.KeyCode.S then
		sPressed = true
	elseif key.KeyCode == Enum.KeyCode.A then
		aPressed = true
	elseif key.KeyCode == Enum.KeyCode.D then
		dPressed = true
	end
end)

uis.InputEnded:Connect(function(key)	
	if key.KeyCode == Enum.KeyCode.W then
		wPressed = false
	elseif key.KeyCode == Enum.KeyCode.S then
		sPressed = false
	elseif key.KeyCode == Enum.KeyCode.A then
		aPressed = false
	elseif key.KeyCode == Enum.KeyCode.D then
		dPressed = false
	end
end)

while wait() do
	if flying then
		char.PrimaryPart:FindFirstChild("FlightForce").Velocity = Vector3.new(0,0,0)
		forwardAnim:Stop()
		
		if wPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.LookVector * 100
			forwardAnim:Play()
		end
		if sPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.LookVector * -100
			forwardAnim:Play()
		end
		if aPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.RightVector * -100
			forwardAnim:Play()
		end
		if dPressed then
			char.PrimaryPart:FindFirstChild("FlightForce").Velocity = cam.CFrame.RightVector * 100
			forwardAnim:Play()
		end
	else
		wait(1)
	end
end

local RS = game:GetService("RunService")

RS.RenderStepped:Connect(function()
	if flying then
		local unit = (cam.CFrame.Position - char.HumanoidRootPart.CFrame.Position).Unit
		local look = char.HumanoidRootPart.CFrame.Position * unit
		
		char.HumanoidRootPart.CFrame = CFrame.new(char.HumanoidRootPart.CFrame.Position, unit)
	end
end)