What is the Backpack in Tynker?

The Backpack tool is a developer’s best friend. With the Backpack, you can save Actors and segments of code and use them in different projects. This way, you can write some multi-purpose functions and use them in future projects without having to write them again.

Using the BackPack

Where do I find the Backpack tool?

Upon creating a new project, the Backpack icon is located on the right side of the toolbar of Tynker Workshop.

How do I use the Backpack tool?

Click the Backpack icon and drag any blocks or actors into the drop-down space (these can be single blocks, or even a stack of multiple blocks).

Now that blocks are saved in your Backpack, simply drag blocks from the Backpack of your choosing into your new project. Every project on your account will have access to the Backpack.

{"func":"blockPlayerGiveItem","values":[{"type":"number","value":"1"},{"type":"string","value":"iron_sword"},{"type":"string","value":"add player block here"}]}

Give Item to Player

"Give Item" is a block that puts an item into the inventory of a player.


Item count: This parameter is how many of the item will be given.

Item type: This parameter sets which type of item to give.

Player: This is the player that will receive the item(s).

Related Blocks:
{"func":"blockPlayerLaunchesProjectile"} ,     {"func":"blockPlayerSetEquipment"} ,     {"func":"blockInventorySetInventory"}

Sample Code:
{"func":"blockControlForEach","values":[{"type":"wrapper","func":"valueWorldGetEntitiesByType","values":[{"type":"string","value":"player"}]},{"type":"wrapper","func":"valueScriptVar","name":"p"}],"containers":[{"func":"blockPlayerGiveItem","values":[{"type":"number","value":"1"},{"type":"string","value":"diamond_sword"},{"type":"wrapper","func":"valueScriptVar","name":"p"}]}]} Add to my Backpack

{"func":"blockPlayerClearInventory","values":[{"type":"string","value":"add player block here"}]}

Clear Inventory

"Clear Inventory" is a block that empties the inventory of a player.


Player: This parameter is which player will have their inventory cleared.

Related Blocks:
{"func":"blockPlayerGiveItem"} ,     {"func":"blockPlayerSetEquipment"}

Sample Code:
{"func":"blockControlForEach","values":[{"type":"wrapper","func":"valueWorldGetEntitiesByType","values":[{"type":"string","value":"player"}]},{"type":"wrapper","func":"valueScriptVar","name":"p"}],"containers":[{"func":"blockPlayerClearInventory","values":[{"type":"wrapper","func":"valueScriptVar","name":"p"}]}]} Add to my Backpack