Add attribute for script

I’m trying to create a script for an entity by:

///codes in here////

As usual, I add attribute for script at the beginning of above function like this:

Raycast.attributes.add('sphereEntity', {type: 'entity'});
Raycast.attributes.add("doubleClickSpeed", {type: "number", default: 0.1, title: "Double Click Speed", 

or I even tried this

         e.script.attribute("doubleClickSpeed",  'number', 0.1);

But none of them worked.
Can anyone help me?
This is my project:
Error is in clone.js.
Thanks a lot.

Do you have a reason for creating a script object via that method over the standard way?

Because at first I use destroy() to destroy it then I want to re-create it with full component of the old entity.