Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Removing Tool not working when touched?

``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)

2 comments

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

0

Is your game filtering enabled or not?

2 answers

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.

1 comment

0

Well thats not the case here.

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.

1 comment

0

It still doesn't work. Neither in Roblox nor Studio

This discussion is preserved as it was. New answers, comments, and votes are closed.