I'm trying to make a job delivery system where the player picks up boxes and deliver them.. How do I make it so a certain item is removed from their inventory without removing all of the tools. This is what I have so far
local debounce = false
script.Parent.Touched:Connect(function(hit)
if not debounce then
debounce = true
local plr = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if plr then
local holders = {plr:FindFirstChild("Backpack"), plr:FindFirstChild("StarterGear"), hit.Parent}
game.Workspace.itemStocks.numberofSoap.Value = game.Workspace.itemStocks.numberofSoap.Value + 1
for i,v in pairs(holders) do
pcall(function()
for i,v in pairs(v:GetChildren()) do
if v:IsA("BackpackItem") then
v:Destroy()
end
end
end)
end
end
wait(15)
debounce = false
end
end)
Thanks :)

3 comments
The item's name is "Box"
I'd recommend changing the variables for line 12; might make it easier to understand, and prevent confusion.
What do you mean? (I'm new to scripting)