Storix
|
  |
| Joined: 19 Jun 2012 |
| Total Posts: 282 |
|
|
| 01 May 2017 04:52 PM |
-- localscript in startergui script.Parent.Parent:WaitForChild("Backpack").ChildAdded:connect(function(child) if #script.Parent:GetChildren() >= 7 then child:Destroy() end end)
So it limits the backpack space to 7 but now any tool that i have doesn't show up when i try to equip them, can someone help?
|
|
|
| Report Abuse |
|
|
|
| 01 May 2017 04:54 PM |
| That's not a good way to make your inventory size smaller anyway... You should think about making a custom inventory. |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 May 2017 04:57 PM |
>> script.Parent.Parent:WaitForChild("Backpack") So Backpack == script.Parent.Parent.Backpack >> if #script.Parent:GetChildren() >= 7 then Backpack ~= script.Parent; notBackpack == script.Parent
So if the number of children in the thing that isn't the backpack is greater than 7, we delete things in the backpack.
|
|
|
| Report Abuse |
|
|
Storix
|
  |
| Joined: 19 Jun 2012 |
| Total Posts: 282 |
|
|
| 01 May 2017 04:58 PM |
so that script deletes anything after you've 7 tools already?
|
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 May 2017 05:01 PM |
| Reread your code and what I wrote. It deletes things in the backpack based on the number of children in whatever the script is parented to (which is not the backpack). |
|
|
| Report Abuse |
|
|
Storix
|
  |
| Joined: 19 Jun 2012 |
| Total Posts: 282 |
|
|
| 01 May 2017 05:02 PM |
SO can you make one so it limits the backpack space to 7?
|
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 May 2017 05:03 PM |
| You try. The underlying problem is simple, and I've outlined the line you need to fix (and basically told you what it should be). |
|
|
| Report Abuse |
|
|
Storix
|
  |
| Joined: 19 Jun 2012 |
| Total Posts: 282 |
|
|
| 01 May 2017 05:08 PM |
script.Parent.Parent:WaitForChild("Backpack") if #script.Parent:GetChildren() >= 7 then child:Destroy() end
is tht right?
|
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 01 May 2017 05:12 PM |
No. Focus on this line only: if #script.Parent:GetChildren() >= 7 then
and reread what I originally posted. |
|
|
| Report Abuse |
|
|
|
| 01 May 2017 05:14 PM |
| And, test it on roblox studio, and if it isn't working look at the output, and try to fix it yourself. "Playing" with lua is the best way to learn it |
|
|
| Report Abuse |
|
|
Storix
|
  |
| Joined: 19 Jun 2012 |
| Total Posts: 282 |
|
|
| 01 May 2017 05:19 PM |
I don't know how to fix it can you do it? I've tried!! even the output shows nothing is wrong
|
|
|
| Report Abuse |
|
|
Wrathsong
|
  |
| Joined: 05 Jul 2012 |
| Total Posts: 22393 |
|
|
| 01 May 2017 05:33 PM |
god stop reposting i already fixed this mistake and its not what you did wrong, it's what i did wrong
you're just begging for code
|
|
|
| Report Abuse |
|
|