Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Removing Tool not working when touched?

Asked by 6 years ago
Edited 6 years ago

``I made a trashcan where when you touch a part the items in your inventory gets removed but it doesn't seem like to work but I have no errors in the output so I don't why it's not working.

playa = game.Players.LocalPlayer
backpacka = playa.Backpack

script.Parent.Parent.Touched:connect(function(p)
    if backpacka then
        for _,v in ipairs(backpacka:GetChildren()) do
            if v:IsA('Tool') then 
                    v:Destroy()
            end
        end
    end
end)
0
This script is a localscript And as seen its in the workspace Localscripts dont run there they only run in the player or if its a decendant of the players character otherwise they just wont run Timmerman73 85 — 6y
0
Is your game filtering enabled or not? Le_Teapots 913 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Sometimes ROBLOX has un-explainable problems that basically is just a problem with the engine. If there was no error in the output, I don't see whats wrong with it, I would have to test it in a game for me to work on it.

0
Well thats not the case here. Le_Teapots 913 — 6y
Ad
Log in to vote
0
Answered by
tek_o 56
6 years ago
Edited 6 years ago

You need to actually assign a function, which you may think you did but you did not. Also there is no need to confuse yourself by assigning names like “backpacka”

function deletetools()
for _,v in pairs(game.Players:GetPlayers()) do
    v.Backpack:ClearAllChildren()
end
end
script.Parent.Parent.Touched:connect(deletetools)

And of course make this local, because I misunderstood the question and don’t feel like changing the answer.

0
It still doesn't work. Neither in Roblox nor Studio RichMan4b 0 — 6y

Answer this question