function onTouch(obj)
if obj.Parent:findFirstChild("Humanoid")~=nil then--I know this checks for a humanoid
p=game.Players:findFirstChild(obj.Parent.Name)--This searches the name of the person I believe.
if p~=nil then -- if there is no name?
ch=p.Backpack:getChildren() --Checks the children of the backpack.
for i = 1, #ch do -- I do not understand this.
if ch[i].Name~="Examine" and ch[i].Name~="Get" and ch[i].Name~="Window" and ch[i].Name~="Mop" and ch[i].Name~="Bathroom" and ch[i].Name~="Water" and ch[i].Name~="Weed" then ch[i]:Remove() end--I do not understand this if function can someone explain it to me?
end
end
end
end
script.Parent.Touched:connect(onTouch)
I do not really comprehend this script, but I need help comprehending it.

1 comment
Just to add a few things: #ch is simply the number of entries in the list, so that we will go through all of them. Also note that many of the practices used in this code are not the best nor most recent ways of doing it, so double check stuff on the wiki or ask about it here if you're not sure what to use.