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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 08 Sep 2017 05:54 AM |
player.Backpack.itemsname:Remove() or player.Backpack.itemsname:Destroy() |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 08 Sep 2017 06:10 AM |
use ur brain
it's ChildAdded not childadded
dont just copy and paste, LEARN |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 08 Sep 2017 06:18 AM |
player.Backpack.itemsname:Remove()
->
player.Backpack["Assault Rifle"]:Remove() same with line 4 |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2017 06:19 AM |
| sorry i added a space to the name in my last post |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 08 Sep 2017 06:53 AM |
^
attempt to index global 'soul' (a nil value) |
|
|
| Report Abuse |
|
|