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: One tool in backpack script!?!?

Previous Thread :: Next Thread 
AnhRulzz is not online. AnhRulzz
Joined: 26 Aug 2012
Total Posts: 5
26 Jan 2014 05:46 PM
I am not good at scripting can someone help me out?

FULL TITLE
Hi how do you make a script that only lets you have one tool/gear in your backpack?
Report Abuse
AnhRulzz is not online. AnhRulzz
Joined: 26 Aug 2012
Total Posts: 5
27 Jan 2014 05:46 PM
Bump
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
27 Jan 2014 05:47 PM
Get the number of tools in backpack
If more than one then delete
Report Abuse
AnhRulzz is not online. AnhRulzz
Joined: 26 Aug 2012
Total Posts: 5
27 Jan 2014 08:55 PM
I want to make a script that automatically deletes the old tool and replaces it with a new tool. For example, if you pick up a rocket then you get the rocket. You walk and pick up a sword. The rocket is deleted from your inventory and the sword gets added. I want it so players only get no more than one tool. PM me on RYANLEWLS or answer this forum. please.
Report Abuse
AnhRulzz is not online. AnhRulzz
Joined: 26 Aug 2012
Total Posts: 5
28 Jan 2014 08:09 AM
Bump
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
28 Jan 2014 08:46 AM
p = game.Players.LocalPlayer
bp = player.Backpack

oldTools = bp:GetChildren()

bp.ChildAdded:connect(function(newtool)
for i=1,#oldTools do
oldTools[i]:Destroy()
oldTools = {newtool}
end)
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
28 Jan 2014 08:53 AM
Game.Players.LocalPlayer.Backpack.ChildAdded:connect(fuction(New)
if New:IsA("Tool") then
for _, Tool in pairs (Game.Players.LocalPlayer.Backpack:GetChildren()) do
if Tool:IsA("Tool") and Tool ~= New then
Tool:Destroy()
end
end
for _, Object in pairs (Game.Players.LocalPlayer.Character:GetChildren())
if Object:IsA("Tool") and Object ~= New then
Object:Destroy()
end
end
end
end)
Report Abuse
AnhRulzz is not online. AnhRulzz
Joined: 26 Aug 2012
Total Posts: 5
28 Jan 2014 02:06 PM
Wow thanks! I'll test them later
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