How to create a shop in roblox studio

Help and Feedback Game Design Support

Hello, my name is Mysterious Silver, I want to make an FPS style game, but I want my store to have a BIG Paintball and Energy Assault style, where you can buy weapons and then you can equip them in the same store section, I want to do something similar for my game I need help, I would really appreciate it

How to create a shop in roblox studio

(Also try to make a shop but the weapon or item is bought several times instead of only buying once already obtained)

try adding a bool value to the player. set it to false originally and then once they buy the item set it to true, make sure to also check it in the buy/equip script.

1 Like

Hey Mysterious Silver!
I wish you luck on your upcoming game!

About your issue, if I were you I would’ve done this. Store your tools or parts in a separate folder in Server Storage/Replicated Storage. Use a separate folder in your server to store player’s inventories with the tools and the id names. Once you’ve done that, make a system of buying the tools. You’ve indicate a gui, so use remote events in that. Clone the tool to the player’s backpack once you’ve passed all the conditions indicated on buying a tool! About your datastore script, I would suggest storing entries of the player’s inventories from the folder we made. Store it in a table datastore when the player leaves the game.

About giving the tools when he enters, clone the tool from your tools folder if it exists in the saved table. If the tool is found in player’s inventory, change the button to equip. If the tool exists in the stored inventory, clone it into startergear/backpack! That should be enough to fix your issue!

If you want a detailed post, here you go! They’ve described it wonderfully!

How to create a shop in roblox studio
How to save your players' inventory items Community Tutorials

In this tutorial, I will show you how to save player’s inventory items. Setup The way I do it with storing tools, is having a folder in ServerStorage named Tools, and all my tools would go there. [image] A second folder would be a folder containing sub-folders, which would contain each players’ inventory. Example of hierarchy: [image] The Inventories folder would start out empty, but a folder with the name of the player who joins will be created, and the tools they have will be put in ther…

2 Likes

I suggest you make a folder inside the Player and when they buy for example “Sword” a BoolValue named “Sword” will get added, and to Equip or Unequip just set the BoolValue to True/False. To find that player already obtain it or no just use :FindFirstChild()

1 Like

Thank you very much my dear friend, I really appreciate it very much

How to create a shop in roblox studio

10 min

Developer products are items which players can buy more than once, making them perfect for in-game currency, ammo, or similar purchases.

For items or abilities that a player might purchase just once, such as a special weapon or a permanent power-up, please refer to Articles/Game Passes One Time Purchases|Game Passes.

To create a new developer product:

  1. In Roblox Studio, click on the Game Settings button from the Home tab.
How to create a shop in roblox studio
  1. Select the Monetization tab.
  2. Next to Developer Products, click the Create button.
How to create a shop in roblox studio
  1. For the new placeholder product, click the
    How to create a shop in roblox studio
    button and select Edit.
How to create a shop in roblox studio
  1. Specify the product’s name and the price.
  2. Click the Save button.

After creating a developer product, Roblox assigns it a unique ID and all products are neatly listed in the Monetization tab.

How to create a shop in roblox studio

Scripting for Developer Products

To take full advantage of developer products, you’ll need to use scripting. Here are some common examples:

Getting a Game’s Developer Products

To gather data for all of the developer products in a game, use the MarketplaceService/GetDeveloperProductsAsync|GetDeveloperProductsAsync() method. This returns a Pages object that you can inspect and filter to build an in-game store, product list GUI, etc.

Getting Product Info

To get information (price, name, image, etc.) for a specific product, use the MarketplaceService/GetProductInfo|GetProductInfo() function with a second argument:

You can prompt a player to purchase one of your developer products with the MarketplaceService/PromptProductPurchase|PromptProductPurchase() method of MarketplaceService. In the following code, the promptPurchase() function can be called when the player presses a Articles/Creating GUI Buttons|button, talks to a vendor NPC, or whatever fits your game design.

After a purchase is made, it’s your responsibility to handle and record the transaction. This can be done through a Script within ServerScriptService using the MarketplaceService/ProcessReceipt|ProcessReceipt callback. The function you define will be called repetitively until it returns Enum.ProductPurchaseDecision.PurchaseGranted.

Roblox itself does not record the purchase history of developer products by specific players, although you can view overall daily/monthly stats as outlined articles/Developer Stats|here. If you want to track player-specific purchase history, it's your responsibility to store the data, typically with Articles/Data store|data stores. See the MarketplaceService/ProcessReceipt|ProcessReceipt reference for a code example which includes data store usage.

The receiptInfo table passed to the processReceipt() callback function contains detailed info on the purchase. See the MarketplaceService/ProcessReceipt|ProcessReceipt reference for a list of keys and descriptions.

Tags:

Check Remember my choice and click

How to create a shop in roblox studio
in the dialog box above to join experiences faster in the future!

The Roblox installer should download shortly. If it doesn’t, start the download now.

Help and Feedback Scripting Support

So I am trying to make a sword shop but I can work out how to make a script for a shop GUI to pop up and you can buy items for example: Hotdog, Sandwich, Burger and Fries.

I have tried most tips still searching so I thought why not ask the Dev Forum.

Still a Noobie at scripting to let you know.

5 Likes

This article goes over the basics of Gui:
https://developer.roblox.com/en-us/articles/Intro-to-GUIs

For a beginner, I recommend looking at some free model GUIs and seeing how they work.

1 Like

There are alot of threads with the same question, please search before creating a thread. I already have created threads on asking help to create shops.

To start out simple, if you want to have a NPC you click and make the gui pop up, you could insert a click detector in the NPC, then add a script.

script.Parent.ClickDetector.MouseClick:Connect(function() game.StarterGui.ShopGUI.Enabled = true --Change ShopGUI to the name of the Gui end)

Now customize the GUI how you want it to be (Make a frame, text, image buttons to buy things, and an exit button)

To script the exit button,

script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Enabled = false -- Remember that your gui structure may not be the same as mine, so maybe add a parent, or delete one if it does not work. end)

3 Likes

Isn’t it bad practice to use Server-Side Scripts to open UIs?

If yes, like every teacher in the world will tell you: “You will learn the mistakes and keep on doing them forever”. In short, that means that you shouldn’t give advice from bad code practices and instead teach the correct way, even if it’s a little bit more complicated.

cc @Bloxrrey

It’s not just that but you shouldn’t be accessing StarterGui if your intention is to make any kind of interactable interfaces. StarterGui is only meant to be a container of Gui instances that will be given to the player upon respawning with exceptions as defined by the ResetOnSpawn property.

@OP There are many free shops on the catalog that you can reference if they just want a basic shop. This is something easily searched for and attempted. If you’re new to code, then it’s best you gain knowledge on the language and make an attempt yourself at doing this.

1 Like