The variable side is generated when a player interacts with a block in the world. The variable contains a whole number based on which side is is selected. Below is a list of the values that are generated based on which block face is interacted with.

0 = below
1 = above
2 = north
3 = south
4 = west (toward setting sun)
5 = east (toward rising sun)

Side Used in Scripting

The number that is generated for the side variable can be used without modification for the player function placeBlock. An example of how this function looks when using this variable can be found below.

player.placeBlock(origin, 35, 11, side);

The above function will place a blue wool block on one side of the block based on which side the player interacted with. Another use for the side variable is to change the location of the origin using scripts based on which side was clicked. An example of the code used to move the origin based on the side variable can be found below.

case 0:
case 1:
case 2:
case 3:
case 4:
case 5:

This moves the origin to the same location that a block would have been placed if if using the placeBlock function. The script can from there check what block is in that location. For a specific example about how this code can be used, please refer to the bucket workaround example.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.