I am trying to make a 'metal detector' that tests for if the player is at a certain XYZ and then clears their inventory. I have been using functions and if and then but it doesn't seem to work.
It would be easier to do a "Player-Hit function" rather than the chosen method.
1) Find a part, insert a script and TouchInterest
2) In the Script, write
function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) then g=hit.Parent.Name h=game.Players:findFirstChild(g).Backpack:getChildren() for i=1, #h do h[i]:remove() end end end script.Parent.Touched:connect(onTouched)
3) Enjoy your anti-weapon door!