Hello, I’ve been wondering how I’d make an anti item dupe system that works with ids
I thought I’d assign into the player data an id and in another datastore the id would have the player user id & item name, etc but I think it’s gonna get rate limited very fast if I check for every items.
You don’t need to use Datastores, just check the items in the game. I use something like this for a game I’m working on; every item is assigned an Id and once it’s added to someone’s backpack is checks every item in the game to see if an item with the same id already exists, if it does just delete it. If you are saving items to a datastore, just wait until this process has finished with a flag of some sort somewhere and then continue with your saving.
The item does not need to have the same Id every time you join the game because you’ve already verified it’s one of it’s kind so you can just save the item name and make new ids in runtime
I don’t understand a lot, is that do what you mean ?
local Cache = {}
local CacheTimeout = 60
function canUseItem(player, itemID)
if Cache[itemID] then
local cacheEntry = Cache[itemID]
if cacheEntry.timestamp + CacheTimeout > os.time() then
if cacheEntry.playerID == player.UserId then
return true
else
return false, "You do not have permission to use this item."
end
else
Cache[itemID] = nil
end
end
local success, result = pcall(function()
return game:GetService("DataStoreService"):GetDataStore("items"):GetAsync(itemID)
end)
if success then
if result.playerID == player.UserId then
Cache[itemID] = {
playerID = player.UserId,
timestamp = os.time()
}
return true
else
return false, "You do not have permission to use this item."
end
else
return false, "An error occurred while checking the item."
end
end
This! I agree, but having a “cure” for both definitely will help because exploiters are slippery. Make sure your item handler’s infrastructure is good and everything that uses it won’t cause any duping with faulty logic; but having a layer of protection if anything does slip through definitely helps, and if something does slip through, you can log it and investigate the cause.
The simple answer is do not let the client send information to the server about what items they have. As a general security rule, only allow the player to request that their items be changed. The server should verify that their request is legitimate. An easier implementation would be to do what you mentioned with item ID’s, but you don’t need any datastore for that. You’d just have to make sure that the player doesn’t possess two items with the same ID.
person A has an item he gives it to person B
person B leaves the server (their data is saved & has the item)
person A crashes the server they’re in making their data not save (their data isnt saved & they still have the item)
You can check the players inventory every so on and check if the player has more than 1 of the same item, or if you have a RemoteEvent to give the player items, check if the player is firing it excessively.