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

How do I make a "metal detector"?

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.

1 answer

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)
  1. Enjoy your anti-weapon door!

1 comment

0

Oh, and the door can be any length. Make sure it is CanCollide = false and also anchored!

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