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: So, this script partially works.

Previous Thread :: Next Thread 
StratusNinja is not online. StratusNinja
Joined: 04 Nov 2012
Total Posts: 6144
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
StratusNinja is not online. StratusNinja
Joined: 04 Nov 2012
Total Posts: 6144
03 Oct 2015 05:57 PM
Bump.

Gloriest Alternam Anz Strataria
Report Abuse
crossbar is online. 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
buildersteven4 is not online. buildersteven4
Joined: 08 May 2009
Total Posts: 1325
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
StratusNinja is not online. StratusNinja
Joined: 04 Nov 2012
Total Posts: 6144
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
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