Advertisement
HowToRoblox

FlamethrowerHandler

Dec 3rd, 2021
2,609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local particles = script.Parent:WaitForChild("Muzzle"):WaitForChild("ParticleEmitter")
  2.  
  3. particles.Enabled = false
  4.  
  5. script.Parent:WaitForChild("Hitbox").Touched:Connect(function() end)
  6.  
  7.  
  8. script.Parent.Activated:Connect(function()
  9.    
  10.     particles.Enabled = true
  11.    
  12.     particles.Parent.Sound:Play()
  13.    
  14.    
  15.     while particles.Enabled == true do
  16.        
  17.         wait(1)
  18.        
  19.         local parts = script.Parent.Hitbox:GetTouchingParts()
  20.        
  21.         local humanoidsDamaged = {}
  22.        
  23.         for i, part in pairs(parts) do
  24.        
  25.             if part.Parent:FindFirstChild("Humanoid") and not humanoidsDamaged[part.Parent.Humanoid] then
  26.                
  27.                 humanoidsDamaged[part.Parent.Humanoid] = true
  28.                
  29.                 part.Parent.Humanoid:TakeDamage(20)
  30.             end
  31.         end
  32.     end
  33. end)
  34.  
  35. script.Parent.Deactivated:Connect(function()
  36.    
  37.     particles.Enabled = false
  38.    
  39.     particles.Parent.Sound:Stop()
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement