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: How to delete backpack items with a script?

Previous Thread :: Next Thread 
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 05:49 AM
I really can't figure out how to use scripting to delete backpack items. And I can't find anything useful at the wiki. Can anyone please help me?
Report Abuse
robjayson is not online. robjayson
Joined: 05 May 2016
Total Posts: 10
08 Sep 2017 05:51 AM
Eh. Ez you need to sell them dummy LOLOL XD bye now! :)
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
08 Sep 2017 05:52 AM
player.backpack.childadded:Connect(function(object)
if object then
object:Destroy()
end
end)


think smarter not harder lad
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 05:54 AM
player.Backpack.itemsname:Remove()
or
player.Backpack.itemsname:Destroy()
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:07 AM
player.Backpack.childadded:Connect(function(object)
if object then
object:Destroy()
end
end)

^This returns "childadded is not a valid member of Backpack"


player.Backpack.itemsname:Remove()
or
player.Backpack.itemsname:Destroy()


^This works but only when I am not holding the item. When I hold it in my hand it says "AssaultRifle is not a valid member of Backpack"

And I want the item (in this case the AssaultRifle) to also be removed when you hold it in your hands.
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
08 Sep 2017 06:10 AM
use ur brain




it's ChildAdded not childadded

dont just copy and paste, LEARN
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:10 AM
if player.Backpack:FindFirstChild("itemsname") then
player.Backpack.itemsname:Remove()
elseif player.Character:FindFirstChild("itemsname") then
player.Character.itemsname:Remove()
end
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:11 AM
Yes I changed your backpack to Backpack but I did the same with Childadded just in this case both didn't work so I decided to paste back your original one.
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:14 AM
if player.Backpack:FindFirstChild("AssaultRifle") then
player.Backpack.itemsname:Remove()
elseif player.Character:FindFirstChild("AssaultRifle") then
player.Character.itemsname:Remove()
end

^ This returns "itemsname is not a valid member of Model" and also "Itemsname is not a valid member of Model" :>
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:17 AM
player.Backpack.ChildAdded:Connect(function(object)
if object then
object:Destroy()
end
end)

^ And this returns "Something unexpectedly tried to set the parent of AssaultRifle to NULL while trying to set the parent of AssaultRifle. Current parent is Backpack."

It disables the item. It is still in my backpack but when I press "1" or click it it doesn't apear in my hand. Yes this sort of works but if it's possible I would prefer that the item also gets removed from the backpack.
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:18 AM
player.Backpack.itemsname:Remove()

->

player.Backpack["Assault Rifle"]:Remove()
same with line 4
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:19 AM
sorry i added a space to the name in my last post
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:21 AM
if player.Backpack:FindFirstChild("AssaultRifle") then
player.Backpack["Assault Rifle"]:Remove()
elseif player.Character:FindFirstChild("AssaultRifle") then
player.Backpack["Assault Rifle"]:Remove()
end

I tried both this and without the spaces between "Assault" and "Rifle" and the outputs are: Assault Rifle is not a valid member of Backpack
And: AssaultRifle is not a valid member of Backpack
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:23 AM
if player.Backpack:FindFirstChild("AssaultRifle") then
player.Backpack.AssaultRifle:Remove()
elseif player.Character:FindFirstChild("AssaultRifle") then
player.Character.AssaultRifle:Remove()
end
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:24 AM
Omg I got it xD

It's this:

if player.Backpack:FindFirstChild("AssaultRifle") then
player.Backpack["AssaultRifle"]:Remove()
elseif player.Character:FindFirstChild("AssaultRifle") then
player.Character["AssaultRifle"]:Remove()
end

We forgot to change line 4 to "Character" it was "player.Backpack["AssaultRifle"]:Remove()" instead of "player.Character["AssaultRifle"]:Remove()"
Report Abuse
Trfe2000 is not online. Trfe2000
Joined: 23 Apr 2016
Total Posts: 73
08 Sep 2017 06:25 AM
Yes I didn't see your last post because I was typing but thanks a LOT for helping me!!
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:26 AM
"We forgot to change line 4"

when i said "same with line 4", i meant make the same change with line 4, rather than change line 4 to line 2
Report Abuse
TheFishToucher is not online. TheFishToucher
Joined: 07 Jul 2012
Total Posts: 7995
08 Sep 2017 06:28 AM
"Yes I didn't see your last post because I was typing but thanks a LOT for helping me!!"
no problem
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
08 Sep 2017 06:46 AM
if Player.Character then
Player.Character.Humanoid:UneqiupTools()
if Player.Backpack:FindFirstChild("Assault Rifle") then
Player.Backpack["Assault Rifle"]:Destroy()
end
end
Report Abuse
SinisterMemories is not online. SinisterMemories
Joined: 21 Mar 2013
Total Posts: 4892
08 Sep 2017 06:53 AM
^


attempt to index global 'soul' (a nil value)
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