title: Roblox script running multiple times?
body: <p>I need a bit of help. Basically I have this code:</p>
  
  <pre><code>local plyIsEntered = false
  
  function onTouched(hit)
  
  plyIsEntered = true
  
  if not plyIsEntered then
  
  end
  
  if plyIsEntered then
  
      local humanoid = hit.Parent:FindFirstChild("Humanoid")
      local ply = humanoid.Parent
      if humanoid ~= nil then
  
          print("Hit")
          local playerName = hit.Parent.Name
          print(playerName)
          local laserEmitter = game.Workspace["Enterance PC"]:FindFirstChild("laserEmitter")
  
          local scanLaser = Instance.new("Part", game.Workspace)
  
          scanLaser.Position = laserEmitter.Position
          scanLaser.Name = "ScanLaser"
          scanLaser.Size = Vector3.new(1,1,1)
          local scanLaserMesh = Instance.new("SpecialMesh", game.Workspace.ScanLaser)
          scanLaserMesh.Name = "Cone mesh"
          scanLaserMesh.MeshType = ""
          plyIsEntered = false
  
  
          end
  
      end
  
  
  
  end
  
  script.Parent.Touched:connect(onTouched)
  </code></pre>
  
  <p>Now I'm checking if the player touches a box, it has no collisions and is invisible; when they do I want to create a laser that will scan them and open a door. The problem I'm having is when I walk into the trigger box it creates 8 or 9 blocks. One of those blocks is the block I'm applying a mesh too.</p>
  
  <p>What I need to do is make sure it's only running once and not creating more than 1 brick. Hopefully someone can help me!</p>