Slower movement sideways

I’m making a first person game… How can I make movement slower, the more sideways the player is moving??

local ForwardSpeed = 30
local SidewaysSpeed = 20

runService.Heartbeat:Connect(function()
	
	-- maybe here
	
	
end)

You can change the speed of the player if the player is moving sideways or forward by detecting which direction their moving using Humanoid.MoveDirection.

I’m not sure how… Do i like check the difference between the look direction and move direction or something like that

local moveDirection = humanoid.MoveDirection
local lookDirection = character:WaitForChild("HumanoidRootPart").CFrame.LookVector
	
local d = moveDirection/lookDirection

Just see if the player is pressing A or D key or see using relative velocity?