Create variable based on local axis

I am trying to instantiate 2 objects when one object gets destroyed. The problem is that if the rotation isn’t straight up it gets instantiated at the wrong position.

var rot:Quaternion = transform.rotation;
var targetBlock : GameObject;
tempPos2 = Vector3(transform.position.x,transform.position.y,transform.position.z+2);
			
tempPos3 = Vector3(transform.position.x,transform.position.y+2,transform.position.z);

var oneBlox : GameObject;

oneBlox = Instantiate (targetBlock, tempPos2, rot);
oneBlox = Instantiate (targetBlock, tempPos3, rot);

Problem is that the tempPos variables seem to be in world space. I need them to be local so it’ll move the instantiated blox to the correct spot relative to the original object and it’s rotation. I tried transform.Translate using Self space, but can’t get it to work on the instantiated objects since it’ll need to spawn in the correct world space then adjust to the correct relative local space from the now destroyed original object.
Here’s the question I suppose:
How can I get a Vector3 variable to work with local and world space to get the instantiated object in the correct world position?

Use Transform.TransformPoint(). It will take a point in local co-ordinates, and translate it to world co-ordinates.

var rot : Quaternion = transform.rotation;
var targetBlock : GameObject;

tempPos2 = transform.TransformPoint(Vector3.forward * 2);
tempPos3 = transform.TransformPoint(Vector3.up * 2);

Instantiate (targetBlock, tempPos2, rot);
Instantiate (targetBlock, tempPos3, rot);