If your Roblox shop lets the client say "I bought this for 50 coins", players can give themselves anything. The fix is simple: the client only asks, the server decides. Here is a small pattern you can drop into any game.

The rule

The client sends an item id. The server looks up the price, checks the balance, then changes the data. The client never sends a price or a new balance.

1. A server-side catalog

-- ServerScriptService/ShopCatalog (ModuleScript) return { sword = { price = 100 }, boots = { price = 60 }, } 

2. A RemoteFunction the client can call

local Remote = Instance.new("RemoteFunction") Remote.Name = "BuyItem" Remote.Parent = game.ReplicatedStorage local catalog = require(script.Parent.ShopCatalog) local data = {} -- your loaded player data, keyed by player Remote.OnServerInvoke = function(player, itemId) if typeof(itemId) ~= "string" then return false, "bad request" end local item = catalog[itemId] local profile = data[player] if not item or not profile then return false, "unknown item" end if profile.owned[itemId] then return false, "already owned" end if profile.coins < item.price then return false, "not enough coins" end profile.coins -= item.price profile.owned[itemId] = true return true end 

3. Why each check matters

  • typeof check: exploiters can send any type, including tables.
  • Catalog lookup: unknown ids are rejected instead of crashing.
  • Ownership check: stops double charging and duplicate grants.
  • Price on the server: the client cannot change it.

4. Rate limit it

Add a short cooldown per player (for example 0.3 seconds) so a script cannot spam the remote.

5. Save after the purchase

Write the new data through your normal save path, with retries, so a crash right after buying does not lose the item.

Want it built already?

The Game Starter Kit has a server-validated shop, safe saving, settings and a leaderboard wired together and covered by 30 logic tests: https://agurokey.gumroad.com/l/aguro-key-game-starter-kit?utm_source=dev-to&utm_medium=post&utm_campaign=launch

Code LAUNCH25 gives 25% off until Dec 17. The pattern above is free to use.