# Help: onBlockPlaced position

**URL:** https://forum.makecode.com/t/help-onblockplaced-position/22841
**Category:** Minecraft
**Created:** [September 28, 2023, 4:02pm UTC](https://forum.makecode.com/t/help-onblockplaced-position/22841 "2023-09-28T16:02:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)
#### Post date: [September 28, 2023, 4:02pm UTC](https://forum.makecode.com/t/help-onblockplaced-position/22841/1 "2023-09-28T16:02:57Z")

</div>

Hi,

Anyone who knows if there is a way to get the position of the aim/sight or the position of the last block placed in MakeCode for Minecraft?

I am trying to get something to happen around the position of the last block placed OR wherever the sight aims, using the onBlockPlaced funcition block.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [October 16, 2023, 7:04pm UTC](https://forum.makecode.com/t/help-onblockplaced-position/22841/2 "2023-10-16T19:04:01Z")

</div>

You will have to use a variable (or two for x and y) to keep track of the last block placed and update it every time you place a block

---

<div class="post-metadata">

### Author: ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)
#### Post date: [October 17, 2023, 11:54pm UTC](https://forum.makecode.com/t/help-onblockplaced-position/22841/3 "2023-10-17T23:54:16Z")

</div>

Thank you @WoofWoof for your reply!

I’ve been struggling lately with some UWP loopback issue, which suddenly and temporarily cut me off from coding in Minecraft; [https://www.mysysadmintips.com/windows/clients/912-windows-10-uwp-apps-can-t-connect-to-local-ip-loopback-restriction](https://www.mysysadmintips.com/windows/clients/912-windows-10-uwp-apps-can-t-connect-to-local-ip-loopback-restriction)

However, I am hopefully soon back to learn more MakeCode coding inside Minecraft.

Would you happen to know which command block I would use to get the “last block placed” position to put into this variable, or maybe also, which command block to get the position which the player’s crosshair points to when I need that position?
