Problems with instantiating

Hi guys, I’m trying to create a random loot chest but when I try to instantiate the prefab the location is always messed up, but when I tried with a new gameobject it worked fine and I can’t understand why …

here’s the code:
public GameObject Loot;
public Transform LootSpawnPoint;

    int random;

    private void OnCollisionEnter(Collision other)
    {
        random = Random.Range(0, Loot.Length);
        if(other.collider.CompareTag("Player"))
        {
            Instantiate(Loot[random], LootSpawnPoint.transform.position, Quaternion.identity);
        }
    }

and a pic (he shoe is the prefab that should have spawned in the gameobject position):

Two things spring to mind, but I don’t know if either helps:

  • If LootSpawnPoint is of type Transform, do you need to call LootSpawnPoint.transform.position, or just LootSpawnPoint.position?
  • I think Random.Range(0, 1) can return both 0 and 1, therefore you might have an out of bounds error calling Loot[random] (So if Loot.Length is 1, you could be accidentally trying to call the second, non-existent element of Loot)?