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: Using a for loop to remove things in the player's backpack

Previous Thread :: Next Thread 
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
01 Feb 2012 04:26 PM
I have a dewelding script that works when you put it into a model in the workspace, but for some reason it doesn't work when I put it inside of a tool(I've tried using a script and a local script.) I've tried putting a local script and script into the starterpack that removes the welds once the tool is added, but that doesn't work either. Anyone know how I could remove the welds that are inside of the tool once it is unequipped? Here's what I have so far:



script.Parent.Unequipped:connect(function(mouse)

stuff = script.Parent:GetChildren()
for i=1,#stuff do
if stuff[i]:IsA("BasePart") then
stuf = stuff[i]:GetChildren()
for b=1,#stuf do
if stuf[b].ClassName == "Weld" then
stuf[b]:Destroy()
end
end
end
end

end)

 ~drmiewlo
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
01 Feb 2012 06:56 PM
?

 ~drmiewlo
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
01 Feb 2012 08:11 PM
Do scripts just not work in the backpack?

 ~drmiewlo
Report Abuse
soccaboy17 is not online. soccaboy17
Joined: 22 Sep 2009
Total Posts: 3161
01 Feb 2012 08:13 PM
So you want to remove all the welds, within a tool?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
01 Feb 2012 08:13 PM
script.Parent.Unequipped:connect(function(mouse)
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("Tool") then
v:Destroy()
end
end
end)

Like this?

† KMXD †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
01 Feb 2012 08:15 PM
Ehh, sorry didn't read everything :o

script.Parent.Unequipped:connect(function(mouse)
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("Tool") then
for a, b in pairs(v:GetChildren())
if b:IsA("Weld") then
b:Remove()
end
end
end
end)

Idk, try?

† KMXD †
Report Abuse
soccaboy17 is not online. soccaboy17
Joined: 22 Sep 2009
Total Posts: 3161
01 Feb 2012 08:23 PM
Knight, you forgot a the do, on your for loop, and your missing an end...tired?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
01 Feb 2012 08:32 PM
Yes... D:

† KMXD †
Report Abuse
soccaboy17 is not online. soccaboy17
Joined: 22 Sep 2009
Total Posts: 3161
01 Feb 2012 09:00 PM
Also, for thread creator, here is the fixed script:

script.Parent.Unequipped:connect(function(mouse)
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("Tool") then
for a, b in pairs(v:GetChildren()) do
if b:IsA("Weld") then
b:Remove()
end
end
end
end
end)
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
02 Feb 2012 03:42 PM
Didn't work. I honestly have no clue what is wrong with it; I tried putting it in a regular script and a local script inside of the tool.

 ~drmiewlo
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
02 Feb 2012 03:55 PM
Use :ClearAllChildren() on the Backpack.
Report Abuse
drmiewlo is not online. drmiewlo
Joined: 14 Mar 2012
Total Posts: 1782
02 Feb 2012 06:12 PM
I only want to remove the welds, there are meshes in the parts also.

 ~drmiewlo
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