SHARE
TWEET

Serial Generator Lua

Quoteory Sep 12th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local random = Random.new()
  2. local randomMin, randomMax = 100, 99999
  3.  
  4. local InventoryService = {}
  5.  
  6. function InventoryService.getRandomNumber()
  7.     return random:NextInteger(randomMin, randomMax)
  8. end
  9.  
  10. function InventoryService:GetUniqueSerial(Inventory)
  11.    
  12.     local armors = Inventory["Armors"]
  13.     local weapons = Inventory["Weapons"]
  14.    
  15.     local uniqueSerial
  16.    
  17.     local function recursion()
  18.         uniqueSerial = self.getRandomNumber()
  19.         if armors[uniqueSerial] or weapons[uniqueSerial] then
  20.             recursion()
  21.         end
  22.     end
  23.    
  24.     recursion()
  25.    
  26.     return uniqueSerial
  27.    
  28. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top