Attempting to spawn instances at random locations...?

So i have a script, and i am attempting to do something way over my head… my solution (clearly, as you will see) didn’t work.
I have a spawn point that spawns fine, but will only spawn in the same place (wherever i place the empty spawn point game object) What i want it to do is spawn at random locations around that spawn point on a finite ground. Here is the code i am using so far,

function SpawnPickup()
{
    // retrieve the position and rotation of the pickup's spawn point
    var spawnedPickupPosition transform.position.z = Random.Range (-11.7,11.8);
	transform.position.x = Random.Range(11.5,-11.9);
    
    var spawnedPickupRotation:Quaternion = spawnPoint.transform.rotation;
     
    // instantiate (create) the pickup prefab with the above position and rotation
    var spawnedPickup:GameObject = Instantiate(pickupPrefab, spawnedPickupPosition, spawnedPickupRotation);
     
    // set the spawned pickup as a child of the 'PickupSpawnPoints' gameobject that this script is a Component of
    spawnedPickup.transform.parent = spawnPoint.transform;
}

The problem is on line four and five, like i said this is way over my head. Thank you guys!

I’m not sure what you’re trying to do with those first few lines. When debugging, it helps to read the code aloud to yourself as if you were trying to explain what’s happening with each bit of code to a rubber duck sitting next to you. Hopefully then you’ll realise what you’re saying doesn’t make sense and you’ll realise your error.

function SpawnPickup()

{

    // retrieve the position and rotation of the pickup's spawn point

    var spawnedPickupPosition = spawnPoint.transform.position; // copy position
    spawnedPickupPosition.z = Random.Range (-11.7,11.8);
    spawnedPickupPosition.x = Random.Range(11.5,-11.9);

    // instantiate (create) the pickup prefab with the above position and rotation

    var spawnedPickup:GameObject = Instantiate(pickupPrefab, spawnedPickupPosition,  spawnPoint.transform.rotation);

     

    // set the spawned pickup as a child of the 'PickupSpawnPoints' gameobject that this script is a Component of

    spawnedPickup.transform.parent = spawnPoint.transform;

}

Thankyou Cameron, thats perfect. And thanks for the tip, when i read it aloud, you’re right, I didn’t even finish the line before i stopped and realised it was ridiculous.