Download ArticleDownload Article

This How.com.vn 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.

  1. Step 1 Pick three weapons from "Weapons" in the toolbox.
    Your weapons appear in the "Workspace" branch in the explorer tree.
  2. Step 2 Drag the weapons into the "Replicated Storage" branch.
    Advertisement
  3. How.com.vn English: Step 3 Rename the three weapons.
    To rename a weapon, right-click its name and type something unique (without spaces). Be descriptive!
  4. How.com.vn English: Step 4 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.
  5. Step 5 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."
  6. How.com.vn English: Step 6 Select the NPC's head from the right panel and click Head.
  7. How.com.vn English: Step 7 Insert a dialog.
    To do this, right-click Head and go to Insert > Object > dialog.
  8. Step 8 Change the "Purpose" property to "Shop."
    It's in the Properties section.
  9. How.com.vn English: Step 9 Type what you want your NPC to say.
    This goes into the initialprompt box.
  10. How.com.vn English: Step 10 Select the dialog in Explorer and go to Insert > Object.
  11. How.com.vn English: Step 11 Select DialogChoice and change the UserDialog property value.
    Change it to something like, "May I browse your goods?"
  12. How.com.vn English: Step 12 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.
  13. How.com.vn English: Step 13 Add a script into the dialog (not dialog choice).
    Now you can add the lua code for your script.[1]. It should read:
    local dialog = script.Parent.DialogChoiceSelected:connect(function(player, choice)    -- Check the player has a stats object    local stats = player:FindFirstChild('leaderstats')    if not stats then return end     -- And that the stats object contains a gold member    local gold = stats:FindFirstChild('Gold')    if not gold then return end    if choice == script.Parent.DialogChoice.ChoiceA then        if gold.Value >= 5 then -- 5 is the amount of gold you need to purchase this weapon            game.ReplicatedStorage.Weapon1:Clone().Parent = player.Backpack            gold.Value = gold.Value - 5 -- subtract the amount of gold you need to purchase        end    elseif choice == dialog.DialogChoice.ChoiceB then        if gold.Value >= 10 then            game.ReplicatedStorage.Weapon2:Clone().Parent = player.Backpack            gold.Value = gold.Value - 10        end    elseif choice == dialog.DialogChoice.ChoiceC then        if gold.Value >= 15 then            game.ReplicatedStorage.Weapon3:Clone().Parent = player.Backpack            gold.Value = gold.Value - 15        end    endend)
  14. How.com.vn English: Step 14 Save your game.
    Your store is now ready to use.
  15. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How do I use the complicated code in Roblox Studio?
    How.com.vn English: Community Answer
    Community Answer
    Copy and paste what is says above, However, make sure that you paste it in the right place our else it will not work.
  • Question
    Does a shop have to have clothing?
    How.com.vn English: BlobbieNado
    BlobbieNado
    Community Answer
    No, your shop does not have to have clothing. Your shop can be whatever you want to! Just note, some users may want to see clothing and others may not.
  • Question
    Were do you put the items?
    How.com.vn English: Community Answer
    Community Answer
    You can always build your own items, or use the toolbar to find one you like and place them wherever you want in your shop.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      • 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.
      Show More Tips
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      How.com.vn English: Nicole Levine, MFA
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for How.com.vn. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 64,519 times.
      36 votes - 41%
      Co-authors: 20
      Updated: May 24, 2021
      Views: 64,519
      Thanks to all authors for creating a page that has been read 64,519 times.

      Did this article help you?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement