generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help with my inv system GUI

Previous Thread :: Next Thread 
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 08:23 PM
I've been working on this for the past few 20-30 minutes and upon clicking my object nothing happens, the output doesn't even show any errors.


Code:



slot = game.Players.LocalPlayer.PlayerGui.Inventory.Frame

function onClicked(Player)
while true do
if slot.Slot1.InUse == false then
slot.Slot1.InUse = true
slot.Slot1.ID = 1
elseif
slot.Slot1.InUse == true then
if slot.Slot2.InUse == false then
slot.Slot2.InUse = true
slot.Slot2.ID = 1
elseif
slot.Slot2.InUse == true then
if slot.Slot3.InUse == false then
slot.Slot3.InUse = true
slot.Slot3.ID = 1
elseif
slot.Slot3.InUse == true then
if slot.Slot4.InUse == false then
slot.Slot4.InUse = true
slot.Slot4.ID = 1
elseif
slot.Slot4.InUse == true then
if slot.Slot5.InUse == false then
slot.Slot5.InUse = true
slot.Slot5.ID = 1
elseif
slot.Slot5.InUse == true then
if slot.Slot6.InUse == false then
slot.Slot6.InUse = true
slot.Slot6.ID = 1
elseif
slot.Slot6.InUse == true then
if slot.Slot7.InUse == false then
slot.Slot7.InUse = true
slot.Slot7.ID = 1
elseif
slot.Slot7.InUse == true then
if slot.Slot8.InUse == false then
slot.Slot8.InUse = true
slot.Slot8.ID = 1
elseif
slot.Slot8.InUse == true then
if slot.Slot9.InUse == false then
slot.Slot9.InUse = true
slot.Slot9.ID = 1
elseif
slot.Slot9.InUse == true then
if slot.Slot10.InUse == false then
slot.Slot10.InUse = true
slot.Slot10.ID = 1



end
end
end
end
end
end
end
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
TaaRt is online. TaaRt
Joined: 26 Apr 2009
Total Posts: 5039
03 Nov 2017 08:29 PM
Is this a contemporary art exhibition or Lua..?
Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 08:30 PM
Supposed to be an inventory system xD
Report Abuse
TaaRt is online. TaaRt
Joined: 26 Apr 2009
Total Posts: 5039
03 Nov 2017 08:33 PM
I'm having struggles being helpful because of the structure. Why exactly am I seeing a loop without wait for one mouseclick?
Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 08:36 PM
well i tried using what I knew with checks and such, i probably wasn't supposed to put every single slot check in one script or something in that same matter. Any idea on what I could do? if you don't know i'm trying to create a script in which when the when player clicks on an object they pick it up in their inventory after it checks through to see if there is any available slot, and another script will display an image depending on the ID.
Report Abuse
TaaRt is online. TaaRt
Joined: 26 Apr 2009
Total Posts: 5039
03 Nov 2017 08:53 PM
Well you could for instance make a table of slots, setting their value to whatever is in the slot if it's filled.

slots = {}
for i = 1,numberofslots do
slots[i] = {nil,nil} -- or any other table with placeholder values declaring it's empty
end

then on click you loop through all slots again and when you find one that's empty you put the item data in that slot
Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 09:08 PM
So if i understand i would do something such as Slots = ### ## ## ## ## ## ## ## ## ### for i = 1,numberofslots do slots[i] = {nil,nil} -- or any other table with placeholder values declaring it's empty end ?
Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 09:11 PM
slots = game.Players.LocalPlayer.PlayerGui.Inventory.Frame

function onClicked(Player)
while true do
slots = {} -- but what would i place here?
for i = 1,10 do
slots[i] = {nil,nil} -- or any other table with placeholder values declaring it's empty


end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Criticrystal is not online. Criticrystal
Joined: 02 Jan 2016
Total Posts: 8793
03 Nov 2017 09:15 PM
Why do you need a loop for this again?
Report Abuse
darkblooood is online. darkblooood
Joined: 20 Oct 2009
Total Posts: 57
03 Nov 2017 09:16 PM
its an inventory system i'm trying to create that loop checks to see if any slots are available for the item to be in.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image