Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local humanoid = script.Parent.Humanoid
- local playername = script.Parent.Name
- local player = script.Parent
- local pip = game.Players:FindFirstChild(playername)
- local invGUI = pip.PlayerGui.Inventory
- local box1 = invGUI:findFirstChild("Box1")
- local box2 = invGUI:findFirstChild("Box2")
- local box3 = invGUI:findFirstChild("Box3")
- local box4 = invGUI:findFirstChild("Box4")
- local box5 = invGUI:findFirstChild("Box5")
- local box6 = invGUI:findFirstChild("Box6")
- local box7 = invGUI:findFirstChild("Box7")
- local box8 = invGUI:findFirstChild("Box8")
- local selectedbox
- print("Inventory Variables Successfully Initialised")
- function CheckForEmptyBox()
- if box1.Value.Value == 0 then
- selectedbox = box1
- elseif box2.Value.Value == 0 then
- selectedbox = box2
- elseif box3.Value.Value == 0 then
- selectedbox = box3
- elseif box4.Value.Value == 0 then
- selectedbox = box4
- elseif box5.Value.Value == 0 then
- selectedbox = box5
- elseif box6.Value.Value == 0 then
- selectedbox = box6
- elseif box7.Value.Value == 0 then
- selectedbox = box7
- elseif box8.Value.Value == 0 then
- selectedbox = box8
- else print("Inventory is full!")
- end
- end
- local i = 1
- while i < 10 do
- wait(0.2)
- if player.AddItem.Value == true then
- if player.Gathered.Value == "Gold" then
- print("Player has gathered some gold")
- CheckForEmptyBox()
- selectedbox.Value.Value = selectedbox.Value.Value + 1
- selectedbox.Res.Value = "Gold Ore"
- selectedbox.Text = selectedbox.Res.Value
- player.AddItem.Value = false
- player.Gathered.Value = ""
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement