This wikiHow teaches you how to create a basic shop in Roblox using a dialog script. Creating a dialog script is like writing a conversation between the merchant and the buyer.
- Pick three weapons from “Weapons” in the toolbox. Your weapons appear in the “Workspace” branch in the explorer tree.
- Drag the weapons into the “Replicated Storage” branch.
- Rename the three weapons. To rename a weapon, right-click its name and type something unique (without spaces). Be descriptive!
- Make an NPC. NPCs are commonly made from bricks, countertops, or boxes, although you are free to use whatever you wish. If you decide to use bricks, make sure you’ve anchored the bricks in place.
- Select the three pieces of your NPC and rename them “NPC.” To do this, drag the mouse to select all three pieces, right-click the selected area, and then click Group. Call the group “NPC.”
- Select the NPC’s head from the right panel and click .
- Insert a dialog. To do this, right-click Head and go to Insert > Object > dialog.
- Change the “Purpose” property to “Shop.” It’s in the Properties section.
- Type what you want your NPC to say. This goes into the initialprompt box.
- Select the dialog in Explorer and go to > .
- Select and change the UserDialog property value. Change it to something like, “May I browse your goods?”
- Add a response and dialog choices. Set the ResponseDialog property to “Sure!” Then, insert three “DialogChoices” into the “DialogChoice” we just made. Rename them from their defaults and set their UserDialog properties to the names of the weapons.
- Add a script into the dialog (not dialog choice). Now you can add the lua code for your script.. It should read:
- Save your game. Your store is now ready to use.
- Don’t copy and paste the script. Writing it will make it function properly.
- If you’re having problems, be sure to check carefully for typos!
- Make sure your names are exactly the same as the ones specified. Use the same capital letters and spaces.
- You can add a GUI which shows your balance of ‘gold’. YouTube has plenty of tutorials for those.