If you’re copying code you don’t understand then you need to know that you have to type everything exactly.
I don’t see why you’d get the error you did so maybe it’s just an error from somewhere else you made a mistake too but the code you posted here didn’t spell “GetComponent” correctly:
rb2D = gameObject.GetComponet<Rigidbody2D>();
Here’s how to post code on the forums btw: Using code tags properly