How to make a shop GUI in Roblox that exploiters can't abuse
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.
- Make a ScreenGui with a Frame, a UIGridLayout and one ImageButton per item (or build them from ShopItems in a LocalScript).
- On click, call BuyItem:InvokeServer(itemId) and show the message it returns.
- 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
endGood 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 $8Stallwren 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.