Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1.  
  2. --[[
  3. Fixed by Venetrix!
  4. ]]
  5. local Raritytimes = {
  6.     ["Common"] = 5,
  7.     ["Uncommon"] = 3,
  8.     ["Rare"] = 1,
  9. }
  10.  
  11. local CrateInude = false
  12.  
  13. local function opencrate(Chance)
  14.     if CrateInude == false then
  15.         CrateInude = true
  16.         local items = {}
  17.         local frametimes = math.random(30,32)
  18.         local rewardbutton
  19.         for i,v in pairs(game.ReplicatedStorage.ItemStorage:GetChildren()) do
  20.             local rarnumber = Raritytimes[v.Rarity.Value] or 1
  21.             local mathmatical = math.max(Raritytimes[v.Rarity.Value]+Chance)
  22.             for i = 1,mathmatical do
  23.                 table.insert(items,v)
  24.             end
  25.         end
  26.        
  27.         math.randomseed(tick())    
  28.        
  29.         for i = 1,frametimes+5 do
  30.             local item = items[math.random(#items)]
  31.             local newsapme = script.Parent.Unboxing.SempleItem:Clone()
  32.             newsapme.Visible =true
  33.             newsapme.Parent = script.Parent.Unboxing.inner
  34.             newsapme.ItemName.Text = item.Name
  35.             newsapme.Position = UDim2.new(0,100*(i-1),0,0)
  36.             if i == frametimes then
  37.                 rewardbutton = newsapme
  38.             end
  39.         end
  40.         for num = 1,(rewardbutton.Position.X.Offset - (255+math.random(-40,40)))/15 do
  41.             for i,v in pairs(script.Parent.Unboxing.inner:GetChildren()) do
  42.                 v.Position = UDim2.new(0,v.Position.X.Offset -15,0,0)
  43.                 if v.Position.X.Offset <= -150 then
  44.                     v:Destroy()
  45.                 end
  46.             end
  47.             wait(0.01 * 1.05 ^ (num-105)/2)
  48.          
  49.         end
  50.     end
  51. end
  52.  
  53. opencrate(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement