Weight Limit Bypass

I have a custom drug script in currently and each drug has a weight and i have the weight for each drug at 5. (max weight 100).
There is an exploit within that script where they can collect as much as they want and spam it and I’d love some help! I’ll put in a few screenshots and videos here for you.
It looks as though here you can spam ‘e’ and ‘enter’ and it adds those drugs to your inventory.

then about 15 seconds later it adds all the drugs to my inventory.

I’m pretty sure the issue is from the thing in the top left here

found it in the script as well I’m just wondering if someone can give me some code that can fix this? here is what the code looks like for that ui popping up i just need a way to make it go away or go away for a second? Or maybe code that would make it so when it hits the weight limit it stops collecting them?

Any help would be appreciated.

Locate the xPlayer.addInventoryItem(drug, amount) part in the server-side and add a xPlayer.canCarryItem(drug, amount) if statement.

Would look something like this:

if xPlayer.canCarryItem(drug, amount) then
     xPlayer.addInventoryItem(drug, amount)
     xPlayer.showNotification("You can't fit more drugs in your pockets")