How to Make a Tool in Roblox

Posted on

As a Roblox player, you will need something like a shovel or an ax to collect items with. For this case, so you have to make a tool. By the way, how to make a tool in the platform of Roblox? To find out that answer, just keep reading this article.

SETTING UP THE TOOL

To give you a tool at the start of the game, so you have to place it into the StarterPack.

ADD THE TOOL TO STARTERPACK

  • Please download the starter tool and remember where you save it to.
  • In Explorer, under Workspace, you need to right-click on StarterPack.
  • The next step that you need to do is to select Insert from File.
  • Now, you have to find the downloaded starter tool on your computer where you save it.
  • Please, open the starter tool.
  • In this step, you are able to rename Starter Tool to the name which you want players to see. For example, Spoon.
  • Please, play test your game. The players should be equipped with the spoon as soon as they start the game.


SETTING UP THE TOOL SCRIPT

If the tool hits a harvestable object and the player has enough space in their bag, so the player’s item count will go up by 1 on the leader board. You have to know that harvesting an item is going to make it disappear for a few seconds and then it become unharvestable for a few seconds before reappearing. Therefore, this encourages the players to explore for finding more items, instead of just clicking the same item.

CREATE A NEW SCRIPT

  • You need to go back to the StarterPack, under Spoon, you are able to add a new script named ToolScript.
  • Please, add a comment at the top.
  • Then, in ToolScript, type some scripts.

CHECK IF ITEM IS HARVESTABLE

Whenever the tool touches an object, it is going to check if that object has CanHarvest inside and if the boolean is set to True.

  • Please make a new function named onTouch with a parameter named partTouched.
  • Then, you have to search for an object named CanHarvest in whatever touched the tool.
  • Under local canHarvest, type; if canHarvest then. Please press Enter autocomplete add end.
  • Under if canHarvest then, type; print(“Found an item”). This is going to help you check if your script is working.
  • Under the function’s end, type; scoop.Touched:Connect(onTouch). It is going to make the script check if anything is touching the scoop. If so, it is going to call onTouch.
  • Now, you are able to play the game and use the tool on a cupcake. Check in the Output Window that you get the message: “Found an Item” once you are touching that cupcake.

GET THE LEADERBOARD STATS

Before increasing the player’s items, the tools have to find the location of how many items a player has in that player’s leaderboard. So, now you need to get the leader board stats. If you want to know how to get the leader board stats, so you are able to ask other Roblox players on the forum.

Leave a Reply

Your email address will not be published. Required fields are marked *