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: What am i doing wrong?!

Previous Thread :: Next Thread 
Storix is not online. 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
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Valyrian_Advisor is not online. Valyrian_Advisor
Joined: 13 Apr 2013
Total Posts: 1703
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 is not online. 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 is online. 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
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