I’m trying to script trading in my game but I’m concerned about item duping where a malicious player disconnects right after the trade and logs back in with items that were supposed to be traded as well as items obtained from the trade. I know this has been a problem in games even outside of roblox and am interested in hearing how developers would go about tackling this. Here are some of my ideas that may or may not work, in order of complexity.
- Wait a few seconds before loading player datastores upon playeradded. This would delay GetAsync
- Delete items that are being traded from datastores of both players, then add them back after some interval. During that interval if a player dc’s or leaves then they will just lose the items to discourage duping.
- Instead of deleting and adding items, morph the items to become the traded items. Since no items are being added, duping shouldn’t even be possible?
- Delete traded items from datastores then generate two GUIDs, one for each player. These are only generated once the server knows that the datastores no longer have the items. The GUIDs are stored for a brief moment and reference a list of items that were traded. Both clients request the server by giving it the IDs. If the IDs are only ever generated when items are deleted, the trade couldn’t result in a dupe?
I would appreciate any ideas or comments about this topic.
