Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local humanoid = script.Parent.Humanoid
  2. local playername = script.Parent.Name
  3. local player = script.Parent
  4. local pip = game.Players:FindFirstChild(playername)
  5. local invGUI = pip.PlayerGui.Inventory
  6. local box1 = invGUI:findFirstChild("Box1")
  7. local box2 = invGUI:findFirstChild("Box2")
  8. local box3 = invGUI:findFirstChild("Box3")
  9. local box4 = invGUI:findFirstChild("Box4")
  10. local box5 = invGUI:findFirstChild("Box5")
  11. local box6 = invGUI:findFirstChild("Box6")
  12. local box7 = invGUI:findFirstChild("Box7")
  13. local box8 = invGUI:findFirstChild("Box8")
  14. local selectedbox
  15. print("Inventory Variables Successfully Initialised")
  16.  
  17. function CheckForEmptyBox()
  18.     if box1.Value.Value == 0 then
  19.         selectedbox = box1
  20.         elseif box2.Value.Value == 0 then
  21.             selectedbox = box2
  22.         elseif box3.Value.Value == 0 then
  23.             selectedbox = box3
  24.         elseif box4.Value.Value == 0 then
  25.             selectedbox = box4
  26.         elseif box5.Value.Value == 0 then
  27.             selectedbox = box5     
  28.         elseif box6.Value.Value == 0 then
  29.             selectedbox = box6 
  30.         elseif box7.Value.Value == 0 then
  31.             selectedbox = box7
  32.         elseif box8.Value.Value == 0 then
  33.             selectedbox = box8
  34.         else print("Inventory is full!")
  35.     end    
  36. end
  37.  
  38.  
  39.  
  40. local i = 1
  41. while i < 10 do
  42.     wait(0.2)
  43.     if player.AddItem.Value == true then
  44.             if player.Gathered.Value == "Gold" then
  45.                 print("Player has gathered some gold")
  46.                 CheckForEmptyBox()
  47.                 selectedbox.Value.Value = selectedbox.Value.Value + 1
  48.                 selectedbox.Res.Value = "Gold Ore"
  49.                 selectedbox.Text = selectedbox.Res.Value
  50.                 player.AddItem.Value = false
  51.                 player.Gathered.Value = ""
  52.             end
  53.     end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement