Getting more Velocity with LinearVelocity constraint when changing direction compared to constant direction

Hey everyone,

I can’t figure out why is my character getting more velocity when I am flicking.

Velocity when not turning:

Velocity when turning:

LinearVelocity code that gets executed everytime I jump:

local function createForwardVelocity(rootPart, velocitySize, duration)
	local attachment0 = Instance.new("Attachment")
	attachment0.Parent = rootPart
	attachment0.WorldPosition = rootPart.AssemblyCenterOfMass

	local velocity = Instance.new("LinearVelocity")
	velocity.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
	velocity.Attachment0 = attachment0
	velocity.MaxForce = 2000 * rootPart.AssemblyMass
	velocity.LineVelocity = velocitySize
	velocity.LineDirection = rootPart.CFrame.LookVector
	velocity.RelativeTo = Enum.ActuatorRelativeTo.World
	velocity.Parent = rootPart

	local velocityHeartbeat 
	local maxVelocity = 0
	local currentVelocity = 0
	local sum = 0

	velocityHeartbeat = RunService.Heartbeat:Connect(function(dt)
		if sum >= duration then
			velocityHeartbeat:Disconnect()
			velocity:Destroy()
			attachment0:Destroy()
			print("Max Velocity:", maxVelocity)
			return
		end

		sum += dt
		
		attachment0.WorldPosition = rootPart.AssemblyCenterOfMass
		velocity.LineDirection = rootPart.CFrame.LookVector

		local currentVelocity = rootPart.AssemblyLinearVelocity.Magnitude
		if currentVelocity > maxVelocity then
			maxVelocity = rootPart.AssemblyLinearVelocity.Magnitude
		end

		print("Current Velocity:", currentVelocity)
	end)

	return velocity
end

createForwardVelocity(Player.Character.HumanoidRootPart, 40, 0.4)

Place file:
LinearVelocity_Flick_Test.rbxl (45.5 KB)

I would appreciate any ideas on how to fix this. Also, if there’s something not clear, let me know. :slight_smile: