Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. -- BTServer (Server)
  2.  
  3. local tool = script.Parent
  4. local handle = tool.Handle
  5.  
  6. local isBurningRemote = Instance.new("RemoteEvent")
  7. isBurningRemote.Name = "isBurningRemote"
  8. isBurningRemote.Parent = tool
  9.  
  10. local isOnRemote = Instance.new("RemoteEvent")
  11. isOnRemote.Name = "isOnRemote"
  12. isOnRemote.Parent = tool
  13.  
  14. local isOffRemote = Instance.new("RemoteEvent")
  15. isOffRemote.Name = "isOffRemote"
  16. isOffRemote.Parent = tool
  17.  
  18. local isOn = false
  19. local flameBrick = tool.FlameBrick
  20. local flame = tool.FlameBrick.ParticleEmitter
  21. local light = tool.FlameBrick.SpotLight
  22.    
  23. local trigger = tool.Trigger
  24. local targetFire = tool.BTFire
  25.  
  26. function activateWeld(a)
  27.     if a:IsA("BasePart") then
  28.         local x, y = tool.Handle, a
  29.         local w = Instance.new("Weld")
  30.         w.Part0 = x
  31.         w.Part1 = y
  32.         local CJ = CFrame.new(x.Position)
  33.         local C0 = x.CFrame:inverse()*CJ
  34.         local C1 = y.CFrame:inverse()*CJ
  35.         w.C0 = C0
  36.         w.C1 = C1
  37.         w.Parent = x       
  38.         a.Anchored = false
  39.     else
  40.         local c = a:GetChildren()
  41.         for i = 1, #c do
  42.             activateWeld(c[i])
  43.         end
  44.     end
  45. end
  46.  
  47. function ignite(val)
  48.     light.Enabled = val
  49.     flame.Enabled = val
  50.     isOn = val
  51. end
  52.  
  53. tool.isBurningRemote.OnServerEvent:Connect(function()
  54.     trigger.Touched:Connect(function(hit)
  55.  
  56.     if isOn then
  57.         local human = hit.Parent:FindFirstChildOfClass("Humanoid")
  58.        
  59.         if human and not hit:FindFirstChild("BTFire") then
  60.            
  61.             local c = targetFire:Clone()
  62.             c.Parent = hit
  63.             for i = human.MaxHealth, 0, -human.MaxHealth * 0.10 do
  64.                 --print(i)
  65.                 human.Health = i
  66.                 wait(human.Health * 0.005)
  67.             end
  68.             print(human.Parent.Name.." died from a blowtorch!")
  69.            
  70.         end
  71.        
  72.         human = nil
  73.     end
  74.    
  75.     end)
  76. end)
  77.  
  78. tool.isOnRemote.OnServerEvent:Connect(function()
  79.     ignite(true)
  80. end)
  81.  
  82. tool.isOffRemote.OnServerEvent:Connect(function()
  83.     ignite(false)
  84. end)
  85.  
  86. function weld()
  87.     activateWeld(tool)
  88. end
  89.  
  90. tool.Equipped:Connect(weld)
  91. tool.Unequipped:Connect(weld)
  92. weld()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement