,I am trying to create a game where you need to push blocks off of a platform, and after a few seconds, a new block spawns that is the clone of the first one. My issue is that when I push a block off the edge, it only counts score for the first one (It counts score when it hits a certain X value), I have tried to make all of the blocks under a tag, and it still only counts the first one when it falls off. I feel like this is really easy to fix, but I am just missing something.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public GameObject box;
public int scoreValue = 50;
public Text score;
// Start is called before the first frame update
void Start()
{
box = GameObject.FindGameObjectsWithTag("clone");
score = GetComponent<Text>();
}
void Update()
{
if (box.transform.position.y <= -9.5 && box.transform.position.x < 23)
{
score.text = "" + scoreValue.ToString();
}
if (box.transform.position.y <= -9.6 && box.transform.position.x < 23)
{
box.transform.position = new Vector2(50,50);
}
}
}