LUA   94

script

Guest on 18th April 2022 12:59:01 AM

  1. local brick = script.Parent
  2. local onepos = brick["1"].Position
  3. local twopos = brick["2"].Position
  4. local threepos = brick["3"].Position
  5. local fourpos = brick["4"].Position
  6. local fivepos = brick["5"].Position
  7. local sixpos = brick["6"].Position
  8. local sevenpos = brick["7"].Position
  9. local eightpos = brick["8"].Position
  10.  
  11. local oneori = brick["1"].Orientation
  12. local twoori = brick["2"].Orientation
  13. local threeori = brick["3"].Orientation
  14. local fourori = brick["4"].Orientation
  15. local fiveori = brick["5"].Orientation
  16. local sixori = brick["6"].Orientation
  17. local sevenori = brick["7"].Orientation
  18. local eightori = brick["8"].Orientation
  19.  
  20. local RESET_SECONDS = 1
  21. local isTouched = false  -- Declare debounce variable
  22.  
  23. function onTouch()
  24.         if not isTouched then  -- Check that debounce variable is not true
  25.                 isTouched = true  -- Set variable to true
  26.         wait(2)
  27.         brick["1"].Anchored = false
  28.         wait(.1)
  29.         brick["2"].Anchored = false
  30.         wait(.1)
  31.         brick["3"].Anchored = false
  32.         wait(.1)
  33.         brick["4"].Anchored = false
  34.         wait(.1)
  35.         brick["5"].Anchored = false
  36.         wait(.1)
  37.         brick["6"].Anchored = false
  38.         wait(.1)
  39.         brick["7"].Anchored = false
  40.         wait(.1)
  41.         brick["8"].Anchored = false
  42.         --return
  43.        
  44.         wait(2.5)
  45.         brick["6"].ParticleEmitter.Enabled = true
  46.         brick["8"].ParticleEmitter.Enabled = true
  47.         wait(.1)
  48.         brick["6"].ParticleEmitter.Enabled = false
  49.         brick["8"].ParticleEmitter.Enabled = false
  50.        
  51.         brick["1"].Anchored = true
  52.         brick["2"].Anchored = true
  53.         brick["3"].Anchored = true
  54.         brick["4"].Anchored = true
  55.         brick["5"].Anchored = true
  56.         brick["6"].Anchored = true
  57.         brick["7"].Anchored = true
  58.         brick["8"].Anchored = true
  59.        
  60.        
  61.        
  62.         brick["1"].Position = onepos
  63.         wait(.1)
  64.         brick["2"].Position = twopos
  65.         wait(.1)
  66.         brick["3"].Position = threepos
  67.         wait(.1)
  68.         brick["4"].Position = fourpos
  69.         wait(.1)
  70.         brick["5"].Position = fivepos
  71.         wait(.1)
  72.         brick["6"].Position = sixpos
  73.         wait(.1)
  74.         brick["7"].Position = sevenpos
  75.         wait(.1)
  76.         brick["8"].Position = eightpos
  77.         wait(.1)
  78.        
  79.  
  80.        
  81.         brick["1"].Orientation = oneori
  82.         wait(.1)
  83.         brick["2"].Orientation = twoori
  84.         wait(.1)
  85.         brick["3"].Orientation = threeori
  86.         wait(.1)
  87.         brick["4"].Orientation = fourori
  88.         wait(.1)
  89.         brick["5"].Orientation = fiveori
  90.         wait(.1)
  91.         brick["6"].Orientation = sixori
  92.         wait(.1)
  93.         brick["7"].Orientation = sevenori
  94.         wait(.1)
  95.         brick["8"].Orientation = eightori
  96.         wait(.1)
  97.        
  98.                 wait(RESET_SECONDS)  -- Wait for reset time duration
  99.                 isTouched = false  -- Reset variable to false
  100.         end
  101.         end
  102.  
  103. brick.PrimaryPart.Touched:connect(onTouch)

Raw Paste


Login or Register to edit or fork this paste. It's free.