Is spinning is not working within if block

I need to check that if a motor is spinning then I need to execute code. but is spinning block always return false in if condition and my code never execute.
Please help.

IsSpinning only returns true if you have used a spinFor or spinTo function, it indicates the motor is performing some type of “go to position” command. You can check motor velocity if you just need to see if it is moving.


thanks. checking velocity resolved my problem.