CyberMax
CyberMax › Answers

How to make a shop GUI in Roblox that exploiters can't abuse

Updated 2026-10-17 · Roblox and game developers · by CyberMax

Short answer

Put the item list (ids and prices) in a ModuleScript in ReplicatedStorage so the GUI can show it, but let the server decide: the GUI's Buy button sends only the item id through a RemoteFunction, and the server looks up the price, checks the player has enough coins, takes the coins and grants the item.

  1. Make a ScreenGui with a Frame, a UIGridLayout and one ImageButton per item (or build them from ShopItems in a LocalScript).
  2. On click, call BuyItem:InvokeServer(itemId) and show the message it returns.
  3. Give owned tools when the player spawns by reading data.owned on the server.

Copy-paste code

Server side of the shop

-- ReplicatedStorage/ShopItems (ModuleScript)
-- return { speed_coil = { name = "Speed Coil", price = 250 }, gravity_coil = { name = "Gravity Coil", price = 400 } }

local ITEMS = require(game.ReplicatedStorage.ShopItems)
local lastBuy = {}

game.ReplicatedStorage.BuyItem.OnServerInvoke = function(player, itemId)
	if typeof(itemId) ~= "string" then return false, "Bad item" end
	local item = ITEMS[itemId]
	if not item then return false, "Unknown item" end
	if os.clock() - (lastBuy[player] or 0) < 0.5 then return false, "Slow down" end
	lastBuy[player] = os.clock()
	local data = profiles[player] -- your saved profile
	if not data then return false, "Loading" end
	data.owned = data.owned or {}
	if data.owned[itemId] then return false, "Already owned" end
	if (data.coins or 0) < item.price then return false, "Not enough coins" end
	data.coins -= item.price
	data.owned[itemId] = true
	return true, item.name
end

Good to know

Never send the price from the client. If the server trusts a price, an exploiter can buy everything for 0.

Stallwren Shop & Currency System: A shop and currencies that never lose a purchase

from $8

Stallwren is the complete version: multi-currency wallet with caps, a validated catalogue with sales, limits and limited-time items, a daily rotating shop, purchases charged once with automatic refunds, game passes and a shop UI built in code.

Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)

Questions

Should the shop use Robux or coins?

Both are common: coins for most items, and a developer product to sell coin packs for Robux.

How do I show prices like 1.2K?

Format numbers on the client; the free Stallwren sampler includes a formatter for that.

Free: the Roblox Starter Kit

7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.

You get one email to confirm first. Then the kit, and 5 short emails over two weeks. One-click unsubscribe in every email; we never share your address.

Related answers

How to make a Roblox game pass (and give the perk in a script)Create a pass in Creator Hub, then check ownership with UserOwnsGamePassAsync and grant passes bought mid-gameHow to use developer products in Roblox (ProcessReceipt that never double-grants)Sell coins and boosts with developer products: the ProcessReceipt pattern that records each PurchaseId so a pu