Advertisement
Guest User

SHIELD

a guest
Apr 4th, 2020
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. local module = {}
  2.  
  3. local TweenService = game:GetService("TweenService")
  4.  
  5. local Execute = workspace:WaitForChild("Execute")
  6.  
  7. module.Clone = function(seconds, animTime)
  8.     local Assets = script.Parent:WaitForChild("Assets")
  9.     local healingCircle = Assets:WaitForChild("healingCircle")
  10.    
  11.     local coolDown = false
  12.    
  13.     Execute.OnServerEvent:Connect(function(plr)
  14.         local healingCircleClone = healingCircle:Clone()
  15.        
  16.         healingCircleClone:WaitForChild("heal").Disabled = false
  17.        
  18.         repeat wait() until plr.Character
  19.         local Character = plr.Character
  20.        
  21.         local HRP = Character:WaitForChild("HumanoidRootPart")
  22.        
  23.         local Humanoid = Character:WaitForChild("Humanoid")
  24.        
  25.         if not coolDown then
  26.             coolDown = true
  27.                        
  28.             local Map = workspace:FindFirstChild(game.ReplicatedStorage.ActiveMap.Value)
  29.        
  30.             if Map ~= nil then
  31.                 local Folder = Map:FindFirstChild("Blocks")
  32.  
  33.                 if Folder ~= nil then
  34.                     healingCircleClone.Parent = Folder
  35.                 end
  36.             end
  37.  
  38.             local tweenInfo = TweenInfo.new(animTime)
  39.  
  40.             local goal_One = {}
  41.             goal_One.Size = Vector3.new(140, 9, 9)
  42.            
  43.             local tween_One = TweenService:Create(healingCircleClone, tweenInfo, goal_One)
  44.             tween_One:Play()
  45.            
  46.             local Weld = Instance.new("Weld")
  47.            
  48.             if HRP then
  49.                 healingCircleClone.Anchored = false
  50.                
  51.                 Weld.Part0 = HRP
  52.                 Weld.Part1 = healingCircleClone
  53.                
  54.                 healingCircleClone.CFrame = HRP.CFrame - Vector3.new(0, 10, 0)
  55.                 healingCircleClone.CFrame = healingCircleClone.CFrame * CFrame.Angles(0, 0, math.rad(90))
  56.                
  57.                 Weld.C0 = HRP.CFrame:inverse()
  58.                 Weld.C1 = healingCircleClone.CFrame:inverse()
  59.                
  60.                 Weld.Parent = healingCircleClone
  61.             end
  62.            
  63.             if Humanoid then
  64.                 Humanoid.Died:Connect(function()
  65.                     local goal_Three = {}
  66.                     goal_Three.Transparency = 1
  67.                    
  68.                     local tween_Three = TweenService:Create(healingCircleClone, tweenInfo, goal_Three)
  69.                     tween_Three:Play()
  70.                    
  71.                     wait(animTime)
  72.                     healingCircleClone:Destroy()
  73.                 end)
  74.             end
  75.            
  76.             wait(seconds)
  77.            
  78.             local goal_Two = {}
  79.             goal_Two.Size = Vector3.new(0, 9, 9)
  80.            
  81.             local tween_Two = TweenService:Create(healingCircleClone, tweenInfo, goal_Two)
  82.             tween_Two:Play()
  83.            
  84.             wait(animTime)
  85.            
  86.             healingCircleClone:Destroy()
  87.             coolDown = false
  88.         end
  89.     end)
  90. end
  91.  
  92. return module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement