Joriangames

SCARY FLASHLIGHTS by BloxianCode

Jun 17th, 2023 (edited)
1,200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. -- SCARY FLASHLIGHTS TUTORIAL BY BLOXIANCODE youtube.com/c/BloxianCode
  2. -- Tutorial: https://youtube.com/shorts/EpbP6X1TvGY
  3.  
  4. while true do --creates a while loop. All code inside this loop will loop forever
  5.  
  6.     for i, part in pairs(script.Parent:GetChildren()) --Script goes through all parts in the folder where this script is located
  7.         if part:FindFirstChild("SpotLight") then --if a part has a SpotLight in it, then..
  8.             local light = part.SpotLight --create a variable for the SpotLight
  9.            
  10.             light.Enabled = false --Turn the light off by disabling the light
  11.             wait(math.random(0,1)) --let the script wait a random amount of time between 0 and 1 second
  12.             light.Enabled = true --Turn the light back on by enabling the light
  13.             wait(math.random(0,1)) --let the script wait a random amount of time between 0 and 1 second
  14.  
  15.         end --end the if-statement 
  16.     end --end the for-loop
  17.  
  18. end --end the while-loop
Advertisement
Add Comment
Please, Sign In to add comment