I was looking for a way to get the vehicle's direction and I found someone who posted this code on the Roblox Dev Forum. He didn't really explain what it did and I'm really interested in how the maths of it work. I looked on the Roblox API, googled around, and played around with the code but I still don't understand how it works. The post is about three years old so I doubt he will reply if I ask on the post.

If anyone could help that'd be really good :>

local function GetMoveDirection()
		local direction = -((seat.CFrame - seat.Position):Inverse() * seat.Velocity).Z
		direction = math.abs(direction) <= 0.001 and 0 or math.sign(direction)
		print(direction)
		return direction
	end
	GetMoveDirection()