Wrong position (always 0,0,0) when Instantiate prefab.

So i am trying to make simple PingPong 2D, the ball is instantiate when you click “Fire1” and I want to make trail effect with spawnings another balls that are animated to fade out and i want same position as instantiate ball but it is spawning all the time at (0,0,0). I chceked transform.position by Debug.Log and it’s good, and show the current position that’s why i have no clue what to do :confused:

The code :

public class TrailBall : MonoBehaviour
    public GameObject ballPrefabTrail;

    public float spawnDuration = 1f;
    private float spawnDurationCountdown = 0f;

    void Update()
        if (spawnDurationCountdown <= 0)
            GameObject instance = Instantiate(ballPrefabTrail, transform.position, transform.rotation) as GameObject;
            Destroy(instance, 3f);
            spawnDurationCountdown = spawnDuration;
            spawnDurationCountdown -= Time.deltaTime;

@Martines_01 First try to set position of the instantiated ball to 0 and then (after instantiation) set instantiated ball position to position of main ball:

// (...)
GameObject instance = Instantiate(ballPrefab, Vector2.zero, transform.rotation) as GameObject;
// Now set position of new ball
instance.transform.position = transform.position;

I think that this code will work.