What does it say in debug mode?
Perhaps you are using countsurface on an entity which is not a mesh. IE if you are loading the entity with loadanimmesh then it is possible that the entity you are calling 'countsurface' on is a pivot or bone.
Perhaps you are using countsurface on an entity which is not a mesh. IE if you are loading the entity with loadanimmesh then it is possible that the entity you are calling 'countsurface' on is a pivot or bone.