|
| 03 Oct 2015 05:45 PM |
if script.Parent.Parent.Parent.Backpack:FindFirstChild("PX") then for _,child in pairs(script.Parent.Parent.Parent.Backpack:GetChildren()) do if child.ClassName == "Tool" or child.ClassName == "HopperBin" then child:Remove() game.ServerStorage.PX:Clone().Parent = script.Parent.Parent.Parent.Backpack game.ServerStorage.CW2:Clone().Parent = script.Parent.Parent.Parent.Backpack end end end
Sorry for horrible formatting.
Basically from what I believe it should clear the backpack then replace with new weapons. The script does work to some extent. It will add the news tools, but for some reason isn't removing the previous tools from the backpack. Advise?
Gloriest Alternam Anz Strataria |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 05:57 PM |
Bump.
Gloriest Alternam Anz Strataria |
|
|
| Report Abuse |
|
|
crossbar
|
  |
| Joined: 08 Dec 2009 |
| Total Posts: 2817 |
|
|
| 03 Oct 2015 05:59 PM |
| iterate or loop through the player's backpack and remove every child in it. Then add new weapons afterwards. |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2015 06:00 PM |
game.ServerStorage.PX:Clone().Parent = script.Parent.Parent.Parent.Backpack game.ServerStorage.CW2:Clone().Parent = script.Parent.Parent.Parent.Backpack
This ^ probably shouldn't be in the for loop. (That's why you should properly format your script.) |
|
|
| Report Abuse |
|
|
|
| 04 Oct 2015 03:59 AM |
Thanks a lot builder. It's usually the very obvious mistakes that fail me.
Gloriest Alternam Anz Strataria |
|
|
| Report Abuse |
|
|