Guides
How to make a shop in Roblox: the 4 parts every shop needs
Straight answer
Every working Roblox shop, from a simple sword stand to a full pet gacha, is the same four pieces: a GUI the player clicks, a RemoteEvent that carries the request, a server script that verifies and executes the purchase, and a currency stat to spend. The one rule that separates a real shop from an exploitable one: the server, never the GUI, decides whether the purchase happens.
Shops look simple from the player's side, click button, get sword. Under the hood they're the first genuinely client-server system most Roblox developers ever build, and that's exactly why so many tutorial shops are broken: they do everything on the client, where exploiters live. This guide walks through the correct architecture, with the server-side code in full.
The four parts
1. The currency stat
Usually a leaderstats folder with an IntValue named Coins, created for each player when they join by a server script. If your game already shows coins on the leaderboard, you have this.
2. The GUI
A ScreenGui in StarterGui with a frame of item buttons. The GUI's only jobs are to look good, show prices, and ask the server to buy. It holds no truth: it doesn't subtract coins, doesn't hand out items.
3. The RemoteEvent
A RemoteEvent instance (say, BuyItem) in ReplicatedStorage. This is the wire between the player's screen and your server. The GUI fires it with the item name; the server listens.
4. The server script, where the shop really lives
This is the piece that matters. It owns the price list, checks the balance, subtracts coins, and grants the item:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local buyEvent = ReplicatedStorage:WaitForChild("BuyItem") -- The server owns the prices. A price shown in the GUI is decoration; -- this table is the truth. local PRICES = { SpeedCoil = 150, RedTrail = 300, } buyEvent.OnServerEvent:Connect(function(player, itemName) -- Never trust the client: validate the item exists... local price = PRICES[itemName] if not price then return end -- ...and that the player can actually afford it. local leaderstats = player:FindFirstChild("leaderstats") local coins = leaderstats and leaderstats:FindFirstChild("Coins") if not coins or coins.Value < price then return end coins.Value -= price -- Grant the item: clone a tool from ServerStorage into the backpack. local item = game:GetService("ServerStorage").ShopItems:FindFirstChild(itemName) if item then item:Clone().Parent = player.Backpack end end)
Three deliberate choices in there:
- The price table lives on the server. If prices came from the client, an exploiter would buy everything for 0.
- Every input is validated. The item must exist in the table and the balance must cover it, because an exploiter can fire
BuyItemwith any arguments they like, any number of times. - Items are cloned from ServerStorage, which clients can't see or touch, not from ReplicatedStorage.
Why "client-side shops" get games robbed
The most common broken pattern, including in many Toolbox free models, is the buy button's LocalScript doing coins.Value -= price and handing over the item. On the player's own screen that appears to work. But client-side changes to leaderstats don't replicate to the server, and worse, exploiters can call the grant logic directly. The symptom is a game where some players have items they never could have afforded. The fix is always the same architecture as above: client asks, server decides.
If you don't want to build this by hand
A shop is four coordinated pieces in four different places, which makes it tedious to assemble even when you understand every line. It's also exactly the kind of describable mechanic AI handles well, with RoThero you'd prompt something like:
"Make a shop GUI with a SpeedCoil for 150 coins and a RedTrail for 300, using my leaderstats Coins, with purchases handled on the server."
and the plugin inserts the GUI, RemoteEvent, and server script wired together into the right services. If you're weighing that against learning to script it yourself or hiring someone, we compared all the paths in how to script in Roblox without coding.
Common questions
Why can't the shop just subtract coins in the GUI script?
Because the GUI runs on the player's own device, and exploiters can run arbitrary code there. Anything the client is trusted to decide, an exploiter can decide differently, free items, negative prices, infinite coins. The client may only ask; the server verifies the price and balance and makes the change.
Can I use a free model shop from the Toolbox?
You can, but audit it first: many free-model shops handle purchases on the client (exploitable), use deprecated APIs, or contain obfuscated code you can't verify. If you can't read what a script does, don't ship it as the thing that controls your game's economy.
What about selling things for Robux instead of in-game coins?
Robux purchases go through a different, official system: Developer Products (consumables, like coin packs) and Game Passes (permanent perks), created on the Roblox website and handled in code via MarketplaceService. Never build your own Robux flow, use MarketplaceService and its ProcessReceipt callback.
More guides
- How to script in Roblox without knowing how to code
- Is there an AI that makes Roblox games?
- Roblox Assistant vs AI script generators
Build your shop in one prompt
Describe a mechanic. RoThero writes the Luau and adds it to Studio. Start with 3 free prompts each month. No card required.
Start free