Hi, I’m trying to do my very first card game, but I can’t find a way to destroy a script from my gameobjects (cards).
So I want to make an end turn function, so when it’s called the player cant drag and drop their cards on the table.

void EndTurn()
	{
		GameObject[] card = GameObject.FindGameObjectsWithTag ("Card");
		int maxcard = card.Length;
		Destroy(card [maxcard].GetComponents<Draggable> ());
		//drg = card.GetComponent<Draggable> ();
		//Destroy (drg);

	}

Any suggestions are much appreciated.

Update 1:
I forgot to mention that in the script i don’t have functions like Start, Update… so it can’t be disabled.

So I used for loop to get every element from my array, then I destroyed them one by one.

void EndTurn()
	{
		GameObject[] card = GameObject.FindGameObjectsWithTag ("Card");
		int maxcard = card.Length;
		for (int i = 0; i < maxcard;) {
			Destroy(card*.GetComponent<Draggable>());*
  •  	i++;*
    
  •  }*
    
  • }*

Could you simply use this?

scriptname.enabled = false;