I would try changing
chg.Location = this.Location;
to
chg.Location = p.Location;
to put the gate where the player is standing. You can get fancier by using x,y, and z offsets from either the player or the item but I don't know what format the CargoHoldGate script expects it to be in...