Getcomponent error, plz help

It is very weird that I had an GameObject worked totally fine. And GetComponent(“scriptname”) function works all right and got the script I wanted. After I let it became an prefab. It showed ‘NullReferenceException:Object Reference not set to an instance of an object’.
It can’t be like that. I am sure that I have that script attached to the object. Even I let that object lose its prefab. The problem remains the same. Please help me.

anyone help?