How to get all scripts attached to a gameojbect?

How to get all the scripts attached to a gameobject and add them into antoher gameobject with the variable values in those scripts untouched?

you can get all scripts attached to a gameObject because the type of all of the is MonoBehaviour but then you can not change their values cause they should be casted to their type for their values to be accessible. i mean if you have a script called Gun, it's a child of MonoBehaviour so if you say

MonoBehaviour[] scripts = GetComponent<MonoBehaviour>();

then scripts will contain all scripts attached the gameObject with the script (including Gun script). but then you can use a monobehaviour's properties and functions on them and for example Gun's ammo variable can not be seen.

so there is not a general way to get all of them but you can get them all by getcomponent and then create a new object of their type and copy them to the new object (with =) and then add the new object of type (say Gun) to the other object with AddComponent but it's not a good way for coding it.

tell me what do you want to do in highlevel to recommend you a better way.