How do I make a secure trading system?

I want to know any tips yall might have for a secure trading system. I’m trying to avoid items being lost or duplicated. I will check if the players are in-game a lot, but I want to ensure that this system will work well. I’m not asking for any code to be written for me though. ( I don’t have any code base for it yet so keep that in mind)
( If this is on the wrong topic, sorry)

1 Like

Trading as for limiteds or in game items?
For safe limiteds trading Roblox is already good enough, but if you’re talking about in game items, just make sure there’s a countdown before the deal gets done therefore it can be canceled if one side decided to scam.

1 Like

you could make a trading system like the psx for in-game items

Ok, I was thinking something like that but the skins I have can all be bought without robux

Is there just skins that can be tradable or any other stuff

Skins and skin crates. And kill effects. But thats it

and ye like @Megalodox_Official said put a timer.

if u get reports of duping, you can find the main source of where it happened

1 Like

There is a special system I have (also don’t mind my avatar and username lol)

Anyway the best system I can think of is

  1. Assign an id to every item in the entire game (use HttpService:GenerateGuid(false))
  2. If the current items in the game don’t have an ID just give them one (check every players inventory every time a player joins or a item is unboxed)
  3. every time a player joins the game, check all the ids of the items in their inventory to the items’s original trader’s inventory but only if the user id value isn’t 0 (you can do this by assigning a userid to the item)
  4. if they do have a item with that id, trade ban them for like 1 week also trade ban the original trader as well
  5. Remove the duped item from the original trader’s inventory
  6. Kick both people from the game.
    Please tell me a good way to get around this if you have any (I cannot think of a possible bypass)
3 Likes

Bro this is some peanut brain stuff compared to what I said lol

You appeared and tried flexing? Go make your own Instagram account for that. Not here.
Next time don’t reply days after, if you truly want to be helpful.

1 Like

Chill, everyone is just giving ideas to help

Problem is that a GUID is memory expensive 128-bits and datastores can be overwhelmed.

The only way I can think to make it safe with datastore is when a trade completes, take all items from both players and ensure both players inventories without the items saved correctly. Only once both players data is successfully saved should you then credit the traded items.

Combine this with session locking and I believe you could make a pretty secure trade system.

Obviously if a player has an issue with saving it’s possible they could not save their new items. But at least items will only ever be lost and not duplicated.

Maybe then you can add some form of proof of trade or do something with http service to log trades. This could potentially help you refund lost items either automatically or manually.

2 Likes

ProfileService, (a datastore module developed by loleris) has built in session locking which should deal with the hardest aspect of trading systems.

Other than that, just do proper sanity checks on the server (have both parties accepted, do they both have the item they are trading, etc).

A common edge case are bait and switches, so you would be wise to implement a cooldown and accepted reset anytime an item is changed.

1 Like