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 » Scripting Helpers
Home Search
 

Re: i really need help

Previous Thread :: Next Thread 
Zulsoras is not online. Zulsoras
Joined: 10 Sep 2008
Total Posts: 963
14 Dec 2012 04:29 PM
I got myself suck in a pit. MY script is full of for, statement to add remove add remove-

I need this script block-- inside of a bigger script that works
to REMOVE anything that is inside of the giver scripts out of the player Backpack so they can not get more than one item

please help

originals = script.Parent.Parent.Parent:getChildren()
for w = 1, #originals do
if originals[w].className == "TextButton" then
toolitems = originals[w].Wep.Givetool:GetChildren()
for a = 1, #toolitems do
toolitemlist = toolitems[a].Name
if (player.Backpack.toolitemlist ~= nil)
player.Backpack.toolitemlist:Destory()
end
end
end
end
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
14 Dec 2012 04:32 PM
So, if they have more than one item, you want all but one deleted?
Report Abuse
Zulsoras is not online. Zulsoras
Joined: 10 Sep 2008
Total Posts: 963
14 Dec 2012 04:42 PM
No- its really complicated.
There are three types of weapons
special
secondary
and prime

a player can have ONE of each

the problem is if a player switches a weapon i need to make it so it only gets rid of items that are from its type and not get rid of a prime weapon- or every weapon.

im trying to do this by getting the names of every tool and if the tool is also in the backpack but not the current tool then it will be deleted
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
14 Dec 2012 04:44 PM
Okay, not to sure how else to do so.
Report Abuse
Zulsoras is not online. Zulsoras
Joined: 10 Sep 2008
Total Posts: 963
14 Dec 2012 04:46 PM
-- Currently

tooltype = script.Parent.Parent.Parent:getChildren()
for b = 1, #tooltype do
if tooltype[b].className == "TextButton" then
toolitems = tooltype[b].Wep.Givetool:GetChildren()
for a = 1, #toolitems do
toolitemlist = toolitems[a].Name
if (player.Backpack.toolitemlist ~= nil) then -- 30
player.Backpack.toolitemlist:Destory()
end
end
end
end

-- error line 30
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
14 Dec 2012 04:49 PM
--change line 30 to
if player.Backpack:findFirstChild("toolitemlist") then
Report Abuse
Zulsoras is not online. Zulsoras
Joined: 10 Sep 2008
Total Posts: 963
14 Dec 2012 05:01 PM
it says
toolitems = tooltype[b].Wep.Givetool:GetChildren()

-- is not a valid member of image button

although The script is place in the button so i do not see why it says this
Report Abuse
Zulsoras is not online. Zulsoras
Joined: 10 Sep 2008
Total Posts: 963
14 Dec 2012 05:15 PM
i think i see the problem

i change it to this

itemnames = script.Parent.Parent.Parent.Itemlist:getChildren()
for b = 1, #itemnames do
iname[b] = itemnames[b].Name
isearch = player.Backpack:getChildren()
for a = 1, #isearch do
if isearch[a].Name == iname then
isearch:Destory()
end
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
14 Dec 2012 05:19 PM
You didn't do isearch[a] and spelled destroy wrong. Try this:


    local ItemNames = script.Parent.Parent.Parent.Itemlist:GetChildren()
    
    for i, v in pairs(ItemNames) do
      local BackPackNames = player.Backpack:GetChildren()
      for a, b in pairs(BackPackNames) do
        if v.Name == b.Name then
          b:Destroy()
        end
      end
    end

Maybe?


¤ † KMXD† ¤

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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