#How does duping actually work?

1 messages · Page 1 of 1 (latest)

versed oak
#

I wanna make the duping prevention code, but I even don't know how does duping works. My shop system is like this:

[client]
local isSuccess = buyItemFunc:InvokeServer(data.ID)

[Server]
`buyItemFunc.OnServerInvoke = function(player, itemID)
if not player:GetAttribute("InShop") then
warn(player.Name .. " Unusual Activity Detection")
return false
end

local character = player.Character
if not character or (character.HumanoidRootPart.Position - TELEPORT_POS).Magnitude > MAX_DISTANCE then
    warn(player.Name .. " Unusual Activity Detection")
    return false
end

local leaderstats = player:FindFirstChild("leaderstats")
local userCoins = leaderstats and leaderstats:FindFirstChild("Coins 🪙")
if not userCoins then return false end

local targetItemData = nil
for _, item in ipairs(shopItems.List) do
    if item.ID == itemID then
        targetItemData = item
        break
    end
end

if targetItemData and userCoins.Value >= targetItemData.Price then
    local toolTemplate = ServerStorage:WaitForChild("Items"):FindFirstChild(itemID)
    if toolTemplate then
        userCoins.Value -= targetItemData.Price
        
        toolTemplate:Clone().Parent = player.Backpack
        toolTemplate:Clone().Parent = player.StarterGear
        return true
    end
end
return false

end`

haughty totem
versed oak
#

I heard somewhere that the exploiter sends RemoteEvents to the server to cause lag and create dupes, or sends multiple events at the same time to create dupes idk if it's right

haughty totem
#

Where people find some bug that gives the item to the other player while not taking it away from the first player

haughty totem
#

So just always subtract the money first