$player.x, $player.y, $player.z - The purchasing players world position

when i use this the spawn entity is always spawn at 0 0 0 coordinates not the player who buy it can you help me how to code this im trying to sell a command that wil spawn recycler in players location.