Spawn along local axis.

How would I create an object 10 units away from another object along the object’s local y axis?
Javascript please.

Instantiate(object, firstObject.transform.up * 10, firstObject.transform.rotation)

you should spawn the object normally along world axis first,than use rotatearound() to make that object snap on the axis you want.

Instantiate(object, firstObject.transform.up + 10, firstObject.transform.rotation)