Er1x_Official

advanced flame pillar server script

Jan 30th, 2022
1,266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.53 KB | None | 0 0
  1. local control = script.Parent
  2. local remote = control:WaitForChild("DAMNFIRE")
  3. local debris = game:GetService("Debris")
  4. local tween = game:GetService("TweenService")
  5. local TIN = TweenInfo.new
  6.  
  7. local animation -- keep this as it is
  8. local holding = false
  9. local hasAttacked = false -- check if guy attacked recently
  10. local fbcooldown = false -- fireball cooldown
  11. local fpcooldown = false -- flame pillar cooldown
  12.  
  13. local ballval = 0
  14. local fbcd_Time = 1 -- fireball cooldown
  15. local fpcd_Time = 3 -- flame pillar cooldown
  16. local attackcd = .5 -- delay between each attacks (prevent spam)
  17. local charge = 0
  18. local maxcharge = 10 -- maximum charge
  19. local fbdamage = 1 -- base fbdamage * fireball charge fbdamage
  20. local fpdamage = 5 -- flame pillar damage
  21. local burndamage = 5 -- burn fbdamage
  22.  
  23. function atkcd(cd)
  24.     hasAttacked = true
  25.     if hasAttacked then
  26.         task.delay(cd,function()
  27.             hasAttacked = false
  28.         end)
  29.     end
  30. end
  31.  
  32. function cvfx(ball:Instance)
  33.     local rando = math.random(5,8)
  34.     local a = Instance.new("Part",ball)
  35.     a.Shape = Enum.PartType.Ball
  36.     a.Material = Enum.Material.Neon
  37.     a.Size = Vector3.new(rando,rando,rando)
  38.     a.Name = "fireball-vfx"
  39.     a.Transparency = 1
  40.     a.Anchored = true
  41.     a.CanCollide = false
  42.     a.CanTouch = false
  43.     a.Massless = true
  44.     a.Parent = ball
  45.     a.Color = Color3.new(1,1,1)
  46.     a.CFrame = ball.CFrame
  47.    
  48.     local aud = script.chargeUp:Clone()
  49.     aud.Parent = ball
  50.     aud:Play()
  51.     debris:AddItem(aud,aud.TimeLength + 1)
  52.    
  53.     charge = charge + 1
  54.     tween:Create(a,TIN(1),{Color = ball.Color,Size = Vector3.new(.1,.1,.1),Transparency = 0}):Play()
  55.     ball:WaitForChild("ParticleEmitter"):Emit(math.random(1,5))
  56.     debris:AddItem(a,1.2)
  57. end
  58.  
  59. function velocity(Part,Speed,Start,End)
  60.     local vel = Instance.new("BodyVelocity",Part)
  61.     vel.Velocity = CFrame.new(Start,End).LookVector * Speed
  62.     vel.MaxForce = Vector3.new(5000,5000,5000)
  63.     vel.P = 10000
  64.     return vel
  65. end
  66.  
  67. function burn(Repeats,DamageDelay,Damage,Humanoid)
  68.     coroutine.wrap(function()
  69.         if Humanoid.Parent ~= nil then
  70.             local checkforpart = Humanoid.Parent:FindFirstChildOfClass("Part")
  71.             local particle = script.burnpe:Clone()
  72.             if checkforpart then
  73.                 local aud = script.burn:Clone()
  74.                 aud.Parent = Humanoid.Parent:FindFirstChildOfClass("Part")
  75.                 aud:Play();debris:AddItem(aud,aud.TimeLength + 1)
  76.             end
  77.  
  78.             for i = 1,Repeats do
  79.                 if Humanoid ~= nil and Humanoid.Parent ~= nil then
  80.                     Humanoid:TakeDamage(Damage)
  81.                     checkforpart = Humanoid.Parent:FindFirstChildOfClass("Part")
  82.                     if checkforpart then
  83.                         local ouch = particle:Clone()
  84.                         ouch.Parent = Humanoid.Parent:FindFirstChildOfClass("Part")
  85.                         ouch:Emit(math.random(5,10))
  86.                         debris:AddItem(ouch,1)
  87.                     end
  88.                 end
  89.  
  90.                 task.wait(DamageDelay)
  91.             end
  92.         end
  93.     end)()
  94. end
  95.  
  96.  
  97. function flamePillarATK(Amount,DistanceOffset,Damage,Humanoid,Parent, Origin, Direction)
  98.     local newdirection = Origin + Direction*2
  99.     local ignorelist = {Parent}
  100.  
  101.     for i = 1,Amount do
  102.         local p = Instance.new("Part",Parent)
  103.         p.Anchored = true
  104.         p.CastShadow = false
  105.         p.CanCollide = false
  106.         p.Size = Vector3.new(.15,.15,.15)
  107.         p.Orientation = Vector3.new(0,180,90)
  108.         p.Shape = Enum.PartType.Cylinder
  109.         p.Color = Color3.fromRGB(255, 170, 0)
  110.         p.Material = Enum.Material.Neon
  111.         p.Position = newdirection + (Direction * p.Size.X * DistanceOffset * i)
  112.  
  113.         local params = RaycastParams.new()
  114.         params.FilterType = Enum.RaycastFilterType.Blacklist
  115.         params.FilterDescendantsInstances = ignorelist
  116.         params.IgnoreWater = true
  117.  
  118.         task.delay(1.5,function()
  119.             if p ~= nil then
  120.                 local fphasdamaged = false
  121.                 local pillarSize = 15
  122.                 local pilar = p:Clone()
  123.                 pilar.Size = p.Size - Vector3.new(0,1,1)
  124.                 pilar.Transparency = 1
  125.                 pilar.Parent = p
  126.                
  127.                 local aud = script.erupt:Clone()
  128.                 aud.Parent = p
  129.                 aud:Play()
  130.                
  131.                 if i > 1 then
  132.                     pillarSize = 15 + 5 * i
  133.                 end
  134.  
  135.                 coroutine.wrap(function()
  136.                     while task.wait(.1) do
  137.                         if p.Parent ~= nil then
  138.                             for _,parts in next,workspace:GetChildren() do
  139.                                 if parts:IsA("Model") then
  140.                                     coroutine.wrap(function()
  141.                                         local eroot = parts:FindFirstChild("HumanoidRootPart")
  142.                                         if eroot and (eroot.Position - p.Position).Magnitude < 10 then
  143.                                             local ehum = parts:FindFirstChildOfClass("Humanoid")
  144.                                             if ehum and ehum ~= Humanoid then
  145.                                                 if fphasdamaged == false then
  146.                                                     fphasdamaged = true
  147.                                                     ehum:TakeDamage(Damage)
  148.                                                     local eroot = ehum.Parent:FindFirstChild("HumanoidRootPart")
  149.                                                     if eroot then
  150.                                                         local vel = velocity(eroot,30,eroot.Position,eroot.Position + Vector3.new(0,100,0))
  151.                                                         debris:AddItem(vel,.1)
  152.                                                     end
  153.                                                     task.delay(1,function()
  154.                                                         fphasdamaged = false
  155.                                                     end)
  156.                                                 end
  157.                                             end
  158.                                         end
  159.                                     end)()
  160.                                 end
  161.                                
  162.                                 task.wait()
  163.                             end
  164.                         else
  165.                             break
  166.                         end
  167.                     end
  168.                 end)()
  169.  
  170.                 tween:Create(pilar,TIN(.25),{Size = Vector3.new(pillarSize,pilar.Size.Y,pilar.Size.Z),Position = Vector3.new(pilar.Position.X + pilar.Size.X,pilar.Position.Y,pilar.Position.Z),Transparency = 0}):Play()
  171.                 task.delay(1.5,function()
  172.                     if pilar ~= nil then               
  173.                         tween:Create(pilar,TIN(.5),{Size = Vector3.new(pillarSize,1,1),Transparency = 1}):Play()
  174.                     end
  175.                 end)
  176.             end
  177.         end)
  178.  
  179.         tween:Create(p,TIN(.5),{Size = Vector3.new(p.Size.X,10,10)}):Play()
  180.         for _,v in next, workspace:GetChildren() do
  181.             if v:IsA("Model") then
  182.                 if v:FindFirstChildOfClass("Humanoid") then
  183.                     table.insert(ignorelist,v)
  184.                     params.FilterDescendantsInstances = ignorelist
  185.                 end
  186.             end
  187.         end
  188.  
  189.         local ray = workspace:Raycast(p.Position,p.Position - Vector3.new(0,1000,0),params)
  190.         if ray then
  191.             local hit = ray.Instance
  192.             if hit then
  193.                 p.Position = Vector3.new(p.Position.X,ray.Position.Y,p.Position.Z)
  194.             end
  195.         else
  196.             p:Destroy()
  197.         end
  198.  
  199.         task.delay(3.5,function()
  200.             if p ~= nil then
  201.                 tween:Create(p,TIN(.5),{Size = Vector3.new(.1,.1,.1),Transparency = 1}):Play()
  202.                 debris:AddItem(p,.65)
  203.             end
  204.         end)
  205.  
  206.         task.wait(.1)
  207.     end
  208. end
  209.  
  210. remote.OnServerEvent:Connect(function(p,v,m)
  211.     local root = p.Character:FindFirstChild("HumanoidRootPart")
  212.     local humanoid = p.Character:FindFirstChildOfClass("Humanoid")
  213.    
  214.     if p.Character ~= nil and root and humanoid then
  215.         local animator = humanoid:FindFirstChildOfClass("Animator")
  216.         if hasAttacked == false and animator then          
  217.             local info = string.lower(tostring(v))
  218.             if fbcooldown == false then
  219.                 if animation == nil then
  220.                     animation = animator:LoadAnimation(control:WaitForChild("Animations").Charge)
  221.                 end
  222.  
  223.                 if info == "fbfire" then
  224.                     fbcooldown = true
  225.                     atkcd(attackcd)
  226.  
  227.                     coroutine.wrap(function()
  228.                         for l = 1,5 do -- repeat 3 times and stop animation
  229.                             animation:Stop()
  230.                             task.wait() -- a bit of delay
  231.                         end
  232.                     end)()
  233.  
  234.                     local totalDmg = fbdamage * charge -- fbdamage multiplied by charge
  235.  
  236.                     animator:LoadAnimation(control:WaitForChild("Animations").Fire):Play()
  237.                     local ball = root.Parent:FindFirstChild("fireball"..ballval)
  238.  
  239.                     if ball then
  240.                         local hasHit = false
  241.  
  242.                         ball.ParticleEmitter:Emit(math.random(5,10))
  243.                         ball.Transparency = 1
  244.                         debris:AddItem(ball,1)
  245.  
  246.                         local ball2 = ball:Clone()
  247.                         ball2.Joint:Destroy()
  248.                         ball2.Name = ball.Name.."_projectile"
  249.                         ball2.Parent = root.Parent
  250.                         ball2.Position = ball.Position
  251.                         ball2.Anchored = false
  252.                         ball2.Transparency = 0
  253.  
  254.                         local aud = script.fire:Clone()
  255.                         aud.Parent = ball2
  256.                         aud:Play()
  257.  
  258.                         debris:AddItem(aud,aud.TimeLength + 1)
  259.                         for _,c in next,ball2:GetChildren() do
  260.                             if c:IsA("Part") then
  261.                                 c:Destroy()
  262.                             end
  263.                         end
  264.  
  265.                         for f,j in next,root.Parent:GetChildren() do
  266.                             if string.match(j.Name,"fireball") then --and not string.match("projectile",j.Name) then
  267.                                 if not string.match(j.Name,"projectile") then
  268.                                     if j ~= ball then
  269.                                         debris:AddItem(j,.5)
  270.                                         animation:Stop()
  271.                                     end
  272.                                 end
  273.                             end
  274.                         end
  275.  
  276.                         debris:AddItem(ball2,10)
  277.                         velocity(ball2,100,ball2.Position,m)
  278.                         ball2.Touched:Connect(function(hit)
  279.                             if hasHit == false then
  280.                                 local IGNORENAME = {"BASE","Base","Baseplate"} -- ignored hit parts name
  281.                                 if hit and not table.find(IGNORENAME,hit.Name) then
  282.                                     if hit.Parent ~= root.Parent and not string.match(hit.Name,"projectile") and not string.match(hit.Name,"vfx") then
  283.                                         hasHit = true
  284.  
  285.                                         local ehum = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
  286.                                         if ehum and ehum ~= humanoid then
  287.                                             ehum:TakeDamage(totalDmg)
  288.                                             burn(5,1,burndamage,ehum)
  289.                                         end
  290.  
  291.                                         tween:Create(ball2,TIN(.45),{Transparency = 1,Size = Vector3.new(5,5,5)}):Play()
  292.                                         debris:AddItem(ball2,.5)
  293.                                     end
  294.                                 end
  295.                             end
  296.                         end)
  297.                     end
  298.  
  299.                     task.delay(fbcd_Time,function()
  300.                         fbcooldown = false
  301.                         charge = 0
  302.                     end)
  303.                 elseif info == "fbholding" then
  304.                     if holding == false then
  305.                         holding = true
  306.                         local ball = root.Parent:FindFirstChild("fireball"..ballval)
  307.                         if ball then
  308.                             if charge < maxcharge then
  309.                                 cvfx(ball) 
  310.                                 charge = charge + 1
  311.                             end
  312.                         end
  313.  
  314.                         task.delay(.5,function()
  315.                             holding = false
  316.                         end)
  317.                     end
  318.                 elseif info == "fbstart" then
  319.                     if fbcooldown == false then
  320.                         local ball = script:WaitForChild("fireball"):Clone()
  321.  
  322.                         ballval = ballval + 1
  323.                         ball.Parent = root.Parent
  324.                         ball.Name = ball.Name..ballval
  325.                         ball.Joint.Part0 = root.Parent:FindFirstChild("Right Arm")
  326.                         task.delay(.1,function()
  327.                             if holding == true then
  328.                                 animation:Play()
  329.                             end
  330.                         end)
  331.                     end
  332.                 end
  333.             end
  334.            
  335.             if fpcooldown == false then
  336.                 if not holding then
  337.                     local info = string.lower(tostring(v))
  338.                     if animation == nil then
  339.                         animation = animator:LoadAnimation(control:WaitForChild("Animations").Charge)
  340.                     end
  341.  
  342.                     if info == "fpfire" then
  343.                         if fpcooldown == false then
  344.                             fpcooldown = true
  345.  
  346.                             coroutine.wrap(function()
  347.                                 atkcd(attackcd)
  348.                                 local i = animator:LoadAnimation(control.Animations.Pillar)
  349.                                 i:Play();task.wait(.2)
  350.                                
  351.                                 flamePillarATK(math.random(5,7),45,fpdamage,humanoid,root.Parent,root.Position,root.CFrame.LookVector)
  352.                             end)()
  353.  
  354.                             task.delay(fpcd_Time,function()
  355.                                 fpcooldown = false
  356.                             end)
  357.                         end
  358.                     end
  359.                 end
  360.             end
  361.         end
  362.     end
  363. end)
Advertisement
Add Comment
Please, Sign In to add comment