error: error: [string "Pen = class()..."]:19: attempt to index local 'self' (a number value)

I’m getting error from title and don’t understand it.
Can you help me?

This is my class.

This usually means that you’ve called a method using a dot instead of a colon. I expect that you have something like pen.forward(50) in your main code.

I can see an example of this on line 33 in what you’ve posted (compare with line 6), though this isn’t the cause of the specific error you’ve gotten.

Thanks. That fixed it.