Advertisement
Firebirdzz

Example 3.2

Dec 19th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.74 KB | None | 0 0
  1. -- Controllable Water beam - Ground lock (serverSided)
  2.  
  3. local replicatedStorage = game:GetService("ReplicatedStorage")
  4. local serverPartsFolder = replicatedStorage.ServerParts
  5. local tool = script.Parent.Parent
  6. local effectFolder = tool.Effects
  7. local effects = effectFolder.C
  8. local serverParts = serverPartsFolder.Water.C
  9. local tweenService = game:GetService("TweenService")
  10. local workspaceFolder = workspace:WaitForChild("ServerEffectStorage")
  11. local configuration = tool.Configuration.C
  12.  
  13. numberOneCharge = nil
  14. numberTwoCharge = nil
  15. numberThreeCharge = nil
  16. bigStarCharge = nil
  17. whirlpoolCFrame = nil
  18. goal = nil
  19. heightUpgrade = 0
  20. characterServer = nil
  21. serverAura = nil
  22. serverFinalCharge = nil
  23. chargeServerCFrame = CFrame.new(0,0,0)
  24. shieldEffect = nil
  25. globalHoldSound = nil
  26.  
  27. serverExplosion = nil
  28. serverCounter = 0
  29.  
  30. beamCreated = false
  31. endBeamServer = nil
  32. beginBeamServer = nil
  33.  
  34. debugGlobalBeginBeamLocation = nil
  35. beamSmoothened = false
  36.  
  37.  
  38. local function turnInvisible()
  39.     for i,v in pairs(characterServer:GetChildren()) do
  40.         if v:IsA("BasePart") or v:IsA("MeshPart") then
  41.             if v.Name ~= "HumanoidRootPart" then
  42.                 v.Transparency = 1
  43.             end
  44.         end
  45.     end
  46.     for i,v in pairs(characterServer:GetChildren()) do
  47.         if v:IsA("Accessory") then
  48.             v.Handle.Transparency = 1
  49.         end
  50.     end
  51. end
  52.  
  53. local function turnVisible()
  54.     for i,v in pairs(characterServer:GetChildren()) do
  55.         if v:IsA("BasePart") or v:IsA("MeshPart") then
  56.             if v.Name ~= "HumanoidRootPart" then
  57.                 v.Transparency = 0
  58.             end
  59.         end
  60.     end
  61.     for i,v in pairs(characterServer:GetChildren()) do
  62.         if v:IsA("Accessory") then
  63.             v.Handle.Transparency = 0
  64.         end
  65.     end
  66. end
  67.  
  68.  
  69.  
  70. effects.RemoteEvents.ChargeUp.OnServerEvent:Connect(function(plr, counter, localCFrame)
  71.     print(plr.Name.." is charging move C. The server measures counter "..counter..". Their current CFrame is:")
  72.     print(localCFrame)
  73.    
  74.     serverCounter = counter
  75.    
  76.     print("Creating charge effect now.")
  77.    
  78.     print("Slowing down user.")
  79.     local humanoid = plr.Character.Humanoid
  80.     local originalWalkSpeed = humanoid.WalkSpeed
  81.     local OriginalJumpPower = humanoid.JumpPower
  82.     humanoid.WalkSpeed = 0
  83.     humanoid.JumpPower = 0
  84.     wait()
  85.     plr.Character.HumanoidRootPart.Anchored = true
  86.     humanoid.WalkSpeed = originalWalkSpeed
  87.     humanoid.JumpPower = OriginalJumpPower
  88.    
  89.     print("Starting with the sounds.")
  90.     local character = plr.Character
  91.     local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  92.     local head = character:WaitForChild("Head")
  93.     if counter == 1 or counter == 2 or counter == 3 then
  94.         local chargeSound = effects.Sounds:WaitForChild("Charging Sound"):Clone()
  95.         chargeSound.Parent = workspace
  96.         chargeSound.Parent = workspaceFolder
  97.         chargeSound:Play()
  98.     elseif counter == 4 then
  99.         local chargeSound = effects.Sounds:WaitForChild("BigStarSound"):Clone()
  100.         chargeSound.Parent = workspace
  101.         chargeSound.Parent = workspaceFolder
  102.         chargeSound:Play()
  103.     elseif counter == 5 then
  104.         local chargeSound = effects.Sounds:WaitForChild("FinalChargeSound"):Clone()
  105.         chargeSound.Parent = workspace
  106.         chargeSound.Parent = workspaceFolder
  107.         chargeSound:Play()
  108.         local holdSound = effects.Sounds:WaitForChild("FountainSound"):Clone()
  109.         holdSound.Parent = workspace
  110.         holdSound.Parent = workspaceFolder
  111.         holdSound:Play()
  112.         globalHoldSound = holdSound
  113.     end
  114.    
  115.     print("Creating the charge Effect.")
  116.    
  117.     local chargeParticlePart = serverParts.ChargeEffect:Clone()
  118.     chargeParticlePart.Parent = workspace
  119.     chargeParticlePart.Parent = workspaceFolder
  120.     chargeParticlePart.CFrame = localCFrame * CFrame.new(0,2,-3)
  121.     chargeParticlePart.Orientation = Vector3.new(90,0,0)
  122.     chargeParticlePart.Orientation = Vector3.new(chargeParticlePart.Orientation.X, humanoidRootPart.Orientation.Y+180, chargeParticlePart.Orientation.Z)
  123.     chargeServerCFrame = chargeParticlePart.CFrame
  124.    
  125.     task.delay(1, function()
  126.         chargeParticlePart:Destroy()
  127.     end)
  128.    
  129.     local particle = chargeParticlePart.Attachment.pulse
  130.     wait()
  131.     particle:Emit()
  132.    
  133.     print("Stacking Effect stars.")
  134.    
  135.     if counter == 1 then
  136.         local starEffect = serverParts.ChargeNumber:Clone()
  137.         starEffect.Parent = workspace
  138.         starEffect.Parent = workspaceFolder
  139.         starEffect.CFrame = localCFrame * CFrame.new(5,2,-3)
  140.         numberOneCharge = starEffect
  141.        
  142.         -- quickly create an explosion for extra effect and animation debugging --
  143.         local explosion = serverParts.Explosion:Clone()
  144.         explosion.Parent = workspace
  145.         explosion.Parent = workspaceFolder
  146.         explosion.CFrame = localCFrame * CFrame.new(0,-5,0)
  147.         for _, particle in pairs (explosion:GetDescendants()) do
  148.             if particle:IsA("ParticleEmitter") then
  149.                 particle.Rate = particle.Rate / 3
  150.             end
  151.         end
  152.         serverExplosion = explosion
  153.        
  154.         local shieldClone = serverParts:WaitForChild("Shield Effect"):Clone()
  155.         shieldClone.Parent = workspace
  156.         shieldClone.Parent = workspaceFolder
  157.         shieldClone.CFrame = localCFrame * CFrame.new(0,0,3)
  158.         local weldC = Instance.new("WeldConstraint")
  159.         weldC.Part0 = character.HumanoidRootPart
  160.         weldC.Part1 = shieldClone
  161.         weldC.Parent = shieldClone
  162.  
  163.         shieldEffect = shieldClone.Attachment
  164.        
  165.         local animation = Instance.new("Animation")
  166.         animation.AnimationId = effects.Animations.WaterZSummon.AnimationId
  167.         local playerAnim = plr.Character.Humanoid:LoadAnimation(animation)
  168.         playerAnim:Play()
  169.        
  170.     elseif counter == 2 then
  171.         local starEffect = serverParts.ChargeNumber:Clone()
  172.         starEffect.Parent = workspace
  173.         starEffect.Parent = workspaceFolder
  174.         starEffect.CFrame = localCFrame * CFrame.new(-5,2,-3)
  175.        
  176.         task.delay(.25, function()
  177.             for _, particle in pairs (serverExplosion:GetDescendants()) do
  178.                 if particle:IsA("ParticleEmitter") then
  179.                     particle.Rate = (particle.Rate * 3) / 2
  180.                 end
  181.             end
  182.         end)
  183.        
  184.         numberTwoCharge = starEffect
  185.        
  186.         shieldEffect.BubbleEffect.Rate *= 2
  187.         shieldEffect.CircleEffect.Rate += 1
  188.        
  189.     elseif counter == 3 then
  190.         local starEffect = serverParts.ChargeNumber:Clone()
  191.         starEffect.Parent = workspace
  192.         starEffect.Parent = workspaceFolder
  193.         starEffect.CFrame = localCFrame * CFrame.new(0,7,-3)
  194.        
  195.         shieldEffect.BubbleEffect.Rate += 3
  196.         shieldEffect.CircleEffect.Rate += 1
  197.        
  198.         task.delay(.25, function()
  199.             for _, particle in pairs (serverExplosion:GetDescendants()) do
  200.                 if particle:IsA("ParticleEmitter") then
  201.                     particle.Rate = ((particle.Rate * 3) / 2) * 3
  202.                 end
  203.             end
  204.         end)
  205.        
  206.         numberThreeCharge = starEffect
  207.        
  208.        
  209.     elseif counter == 4 then
  210.        
  211.         -- Rework
  212.         --humanoidRootPart.Anchored = false
  213.         -- Rework
  214.        
  215.         local starEffect = serverParts.ChargeNumber4:Clone()
  216.         starEffect.Parent = workspace
  217.         starEffect.Parent = workspaceFolder
  218.         starEffect.CFrame = localCFrame * CFrame.new(0,15,15)
  219.         bigStarCharge = starEffect
  220.        
  221.         local tweenInfo = TweenInfo.new(.4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
  222.         local tween = tweenService:Create(plr.Character.HumanoidRootPart, tweenInfo, {CFrame = localCFrame * CFrame.new(0,configuration:WaitForChild("Charge 4 Levitate Height").Value,0)})
  223.         tween:Play()
  224.        
  225.         local animation = Instance.new("Animation")
  226.         animation.AnimationId = effects.Animations.WaterZCharge.AnimationId
  227.         local playerAnim = plr.Character.Humanoid:LoadAnimation(animation)
  228.         playerAnim:Play()
  229.        
  230.         local numberOneChargeTween = tweenService:Create(numberOneCharge, tweenInfo, {CFrame = starEffect.CFrame})
  231.         numberOneChargeTween:Play()
  232.         local numberTwoChargeTween = tweenService:Create(numberTwoCharge, tweenInfo, {CFrame = starEffect.CFrame})
  233.         numberTwoChargeTween:Play()
  234.         local numberThreeChargeTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = starEffect.CFrame})
  235.         numberThreeChargeTween:Play()
  236.        
  237.         task.delay(.25, function()
  238.             for _, particle in pairs (serverExplosion:GetDescendants()) do
  239.                 if particle:IsA("ParticleEmitter") then
  240.                     particle.Rate = 0
  241.                 end
  242.             end
  243.             wait(3)
  244.             serverExplosion:Destroy()
  245.         end)
  246.        
  247.     elseif counter == 5 then
  248.        
  249.         task.delay(.5, function()
  250.         humanoidRootPart.Anchored = true
  251.         end)
  252.        
  253.         numberOneCharge:Destroy()
  254.         numberTwoCharge:Destroy()
  255.         numberThreeCharge:Destroy()
  256.        
  257.         local whirlpoolEffect = serverParts.FinalCharge:Clone()
  258.         whirlpoolEffect.Parent = workspace
  259.         whirlpoolEffect.Parent = workspaceFolder
  260.         whirlpoolEffect.CFrame = localCFrame * CFrame.new(0,20,-3)
  261.         whirlpoolEffect.Orientation = chargeParticlePart.Orientation
  262.         whirlpoolCFrame = whirlpoolEffect.CFrame
  263.         serverFinalCharge = whirlpoolEffect
  264.        
  265.         local tweenInfo = TweenInfo.new(.8, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
  266.         local tween = tweenService:Create(plr.Character.HumanoidRootPart, tweenInfo, {CFrame = localCFrame * CFrame.new(0,configuration:WaitForChild("Charge 5 Levitate Height").Value,0)})
  267.         tween:Play()
  268.        
  269.         local aura = serverParts.Aura:Clone()
  270.         aura.Parent = workspace
  271.         aura.Parent = workspaceFolder
  272.         aura.CFrame = localCFrame * CFrame.new(0,20,0)
  273.         serverAura = aura
  274.        
  275.         local bigStarTween = tweenService:Create(bigStarCharge, tweenInfo, {CFrame = whirlpoolEffect.CFrame})
  276.         bigStarTween:Play()
  277.         print("Firing a beam once started.")
  278.     end
  279.     print(serverCounter)
  280. end)
  281.  
  282. effects.RemoteEvents.StartAttack.OnServerEvent:Connect(function(plr, counter, localCFrame)
  283.     print("Starting attack at servercounter: "..serverCounter)
  284.     plr.Character.Humanoid.WalkSpeed = 16
  285.    
  286.     warn("Measured final server counter: "..counter..".")
  287.    
  288.     wait()
  289.    
  290.     if counter == 1 then
  291.         print("Attacking at counter 1.")
  292.        
  293.         for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
  294.         track:Stop()
  295.         end
  296.        
  297.         plr.Character.HumanoidRootPart.Anchored = false
  298.        
  299.         task.delay(configuration:WaitForChild("Charge 1 Duration").Value, function()
  300.             for _, particle in pairs (shieldEffect:GetChildren()) do
  301.                 particle.Enabled = false
  302.             end
  303.             for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
  304.                 particle.Enabled = false
  305.             end
  306.             wait(shieldEffect.Attachment.shieldOutline.Lifetime)
  307.             shieldEffect:Destroy()
  308.             numberOneCharge:Destroy()
  309.         end)
  310.        
  311.     elseif counter == 2 then
  312.        
  313.         for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
  314.             track:Stop()
  315.         end
  316.        
  317.         print("Attacking at counter 2.")
  318.         plr.Character.HumanoidRootPart.Anchored = false
  319.  
  320.         task.delay(configuration:WaitForChild("Charge 2 Duration").Value, function()
  321.             for _, particle in pairs (shieldEffect:GetChildren()) do
  322.                 particle.Enabled = false
  323.             end
  324.             for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
  325.                 particle.Enabled = false
  326.             end
  327.             for _, particle in pairs (numberTwoCharge.Attachment:GetChildren()) do
  328.                 particle.Enabled = false
  329.             end
  330.             wait(shieldEffect.Attachment.shieldOutline.Lifetime)
  331.             shieldEffect:Destroy()
  332.             numberOneCharge:Destroy()
  333.             numberTwoCharge:Destroy()
  334.         end)
  335.        
  336.     elseif counter == 3 then
  337.        
  338.         for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
  339.             track:Stop()
  340.         end
  341.        
  342.         print("Attacking at counter 3.")
  343.         plr.Character.HumanoidRootPart.Anchored = false
  344.  
  345.         task.delay(configuration:WaitForChild("Charge 3 Duration").Value, function()
  346.             for _, particle in pairs (shieldEffect:GetChildren()) do
  347.                 particle.Enabled = false
  348.             end
  349.             for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
  350.                 particle.Enabled = false
  351.             end
  352.             for _, particle in pairs (numberTwoCharge.Attachment:GetChildren()) do
  353.                 particle.Enabled = false
  354.             end
  355.             for _, particle in pairs (numberThreeCharge.Attachment:GetChildren()) do
  356.                 particle.Enabled = false
  357.             end
  358.             wait(shieldEffect.Attachment.shieldOutline.Lifetime)
  359.             shieldEffect:Destroy()
  360.             numberOneCharge:Destroy()
  361.             numberTwoCharge:Destroy()
  362.             numberThreeCharge:Destroy()
  363.         end)
  364.     end
  365. end)
  366.  
  367.  
  368. -- Script for charge 4 --
  369.  
  370. effects.RemoteEvents.StartMiniBeam.OnServerEvent:Connect(function(plr, TargetCFrame, localCFrame)
  371.     print("Getting location...")
  372.     print(TargetCFrame)
  373.  
  374. --  globalHoldSound:Destroy()
  375.  
  376.     if beamCreated == false then
  377.         beamCreated = true
  378.         for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
  379.             track:Stop()
  380.         end
  381.  
  382.         characterServer = plr.Character
  383.         turnInvisible()
  384.  
  385.         print("Attacking at counter 4. This creates a small water beam.")
  386.  
  387.         local waterBeam = serverParts.SmallWaterBeam:Clone()
  388.         waterBeam.Parent = workspace
  389.         waterBeam.Parent = workspaceFolder
  390.         local beginBeam = waterBeam.StartPart
  391.         local endBeam = waterBeam.EndPart
  392.         endBeamServer = endBeam
  393.         beginBeamServer = beginBeam
  394.  
  395.         beginBeam.CFrame = plr.Character.HumanoidRootPart.CFrame
  396.         endBeam.CFrame = localCFrame
  397.  
  398.         local explosionSound = effects.Sounds.SmallBeamSound:Clone()
  399.         explosionSound.Parent = workspace
  400.         explosionSound.Parent = waterBeam.EndPart
  401.         explosionSound:Play()
  402.  
  403.         local castSound = effects.Sounds.BeginPartSound:Clone()
  404.         castSound.Parent = workspace
  405.         castSound.Parent = waterBeam.StartPart
  406.         castSound:Play()
  407.        
  408.         local tweenInfo = TweenInfo.new(.4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
  409.  
  410.         local numberOneChargeTween = tweenService:Create(numberOneCharge, tweenInfo, {CFrame = beginBeam.CFrame})
  411.         numberOneChargeTween:Play()
  412.         local numberTwoChargeTween = tweenService:Create(numberTwoCharge, tweenInfo, {CFrame = beginBeam.CFrame})
  413.         numberTwoChargeTween:Play()
  414.         local numberThreeChargeTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = beginBeam.CFrame})
  415.         numberThreeChargeTween:Play()
  416.         local bigStarTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = beginBeam.CFrame})
  417.         bigStarTween:Play()
  418.     end
  419.    
  420.     debugGlobalBeginBeamLocation = beginBeamServer
  421.     debugGlobalBeginBeamLocation.CFrame = plr.Character.HumanoidRootPart.CFrame
  422.    
  423.     endBeamServer.CFrame = TargetCFrame
  424. end)
  425.  
  426. effects.RemoteEvents.EndMiniBeam.OnServerEvent:Connect(function(plr)
  427.     -- Reset the beamcreated variable. --
  428.     beamCreated = false
  429.    
  430.     plr.Character.HumanoidRootPart.Anchored = false
  431.    
  432.     task.spawn(function()
  433.     for _, particles in pairs (bigStarCharge.Attachment:GetChildren()) do
  434.         wait()
  435.         particles.Enabled = false
  436.     end
  437.    
  438.     for _, particles in pairs (numberOneCharge.Attachment:GetChildren()) do
  439.         wait()
  440.         particles.Enabled = false
  441.     end
  442.    
  443.     for _, particles in pairs (numberTwoCharge.Attachment:GetChildren()) do
  444.         wait()
  445.         particles.Enabled = false
  446.     end
  447.    
  448.     for _, particles in pairs (numberThreeCharge.Attachment:GetChildren()) do
  449.         wait()
  450.         particles.Enabled = false
  451.     end
  452.    
  453.     for _, particle in pairs (shieldEffect:GetChildren()) do
  454.         wait()
  455.         particle.Enabled = false
  456.     end
  457.     end)
  458.  
  459.     local combineTween = game.TweenService:Create(beginBeamServer, TweenInfo.new(1), {CFrame = endBeamServer.CFrame})
  460.     combineTween:Play()
  461.     turnVisible()
  462.     combineTween.Completed:Connect(function()
  463.         endBeamServer:Destroy()
  464.         beginBeamServer:Destroy()
  465.     end)
  466.  
  467.     wait(.8)
  468.  
  469.     local outlinerModel = serverParts:WaitForChild("WaterOutliner"):Clone()
  470.     outlinerModel.Parent = workspace
  471.     outlinerModel.Parent = workspaceFolder
  472.     outlinerModel.Center.Size /= 100
  473.     outlinerModel.Color.Size /= 100
  474.     outlinerModel.Outer.Size /= 100
  475.     outlinerModel:MoveTo(endBeamServer.Position)
  476.    
  477.     local splashSound = effects.Sounds.Splash:Clone()
  478.     splashSound.Parent = outlinerModel.PrimaryPart
  479.     splashSound:Play()
  480.    
  481.     for _, mesh in pairs(outlinerModel:GetChildren()) do
  482.         local increaseSizeTween = game.TweenService:Create(mesh, TweenInfo.new(2), {Size = mesh.Size * 200, Transparency = 1})
  483.         increaseSizeTween:Play()
  484.         increaseSizeTween.Completed:Connect(function()
  485.             if mesh:FindFirstChildOfClass("ParticleEmitter") then
  486.                 for _, particle in pairs(mesh:GetChildren()) do
  487.                     if particle:IsA("ParticleEmitter") then
  488.                         particle.Enabled = false
  489.                         task.delay(5, function()
  490.                             mesh:Destroy()
  491.                         end)
  492.                     end
  493.                 end
  494.             else
  495.                 mesh:Destroy()
  496.             end
  497.         end)
  498.     end
  499. end)
  500.  
  501. -- Script for charge 5 --
  502.  
  503. effects.RemoteEvents.StartBeam.OnServerEvent:Connect(function(plr, TargetCFrame)
  504.     print("Getting location...")
  505.     print(TargetCFrame)
  506.    
  507.     globalHoldSound:Destroy()
  508.    
  509.     if beamCreated == false then
  510.         beamCreated = true
  511.        
  512.     for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
  513.         track:Stop()
  514.     end
  515.  
  516.     characterServer = plr.Character
  517.     turnInvisible()
  518.    
  519.     print("Attacking at counter 5.")
  520.  
  521.     local waterBeam = serverParts.WaterBeam:Clone()
  522.     waterBeam.Parent = workspace
  523.     waterBeam.Parent = workspaceFolder
  524.     local beginBeam = waterBeam.StartPart
  525.     local endBeam = waterBeam.EndPart
  526.     local vortex = endBeam.Vortex
  527.     vortex.Parent = endBeam:WaitForChild("Attachment")
  528.     --vortex.Parent = workspaceFolder:WaitForChild("Attachmenter")
  529.     endBeamServer = endBeam
  530.     beginBeamServer = beginBeam
  531.        
  532.     beginBeam.CFrame = whirlpoolCFrame
  533.     endBeam.CFrame = whirlpoolCFrame
  534.  
  535.     local explosionSound = effects.Sounds.Explosion:Clone()
  536.     explosionSound.Parent = workspace
  537.     explosionSound.Parent = waterBeam.EndPart
  538.     explosionSound:Play()
  539.  
  540.     local castSound = effects.Sounds.BeginPartSound:Clone()
  541.     castSound.Parent = workspace
  542.     castSound.Parent = waterBeam.StartPart
  543.     castSound:Play()
  544.        
  545.     --[[    task.spawn(function()
  546.             local newPart = Instance.new("Part")
  547.             newPart.Name = "Diffuse"
  548.             newPart.Anchored = true
  549.             newPart.Size = Vector3.new(0.1,0.1,0.1)
  550.             newPart.Transparency = 1
  551.             newPart.Parent = workspace
  552.             newPart.Parent = workspaceFolder
  553.  
  554.             newPart.CFrame = beginBeamServer.CFrame
  555.  
  556.             -- Make the endBeamPart's attachment attached to the new part. --
  557.             local attachment = endBeamServer:WaitForChild("Attachment")
  558.             attachment.Parent = newPart
  559.  
  560.  
  561.             -- Now the part will tween from the startbeam to the endbeam --
  562.             local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0, false, 0)
  563.             local tween = game.TweenService:Create(newPart, tweenInfo, {CFrame = TargetCFrame})
  564.             tween:Play()
  565.             tween.Completed:Connect(function()
  566.                 attachment.Parent = endBeamServer
  567.                 vortex.Parent = endBeamServer
  568.                 newPart:Destroy()
  569.             end)   
  570.         end)    ]]
  571.     end
  572.         debugGlobalBeginBeamLocation = beginBeamServer
  573.         debugGlobalBeginBeamLocation.CFrame = plr.Character.HumanoidRootPart.CFrame
  574.         endBeamServer.CFrame = TargetCFrame
  575.    
  576. end)
  577.  
  578. effects.RemoteEvents.EndBeam.OnServerEvent:Connect(function(plr)
  579.    
  580.     -- Reset the beamcreated variable. --
  581.     beamCreated = false
  582.    
  583.     local distance = (plr.Character.HumanoidRootPart.Position - endBeamServer.Position).Magnitude
  584.     local speed = distance / 100
  585.  
  586.     task.spawn(function()
  587.         if plr.Character.HumanoidRootPart:FindFirstChild("FountainSound") then
  588.             local volume = plr.Character.HumanoidRootPart.FountainSound.Volume
  589.             local onePercent = volume / 100 warn(onePercent)
  590.             for i = 1,100 do
  591.                 wait()
  592.                 plr.Character.HumanoidRootPart.FountainSound.Volume -= onePercent
  593.             end
  594.             plr.Character.HumanoidRootPart.FountainSound:Destroy()
  595.         end
  596.        
  597.     plr.Character.HumanoidRootPart.Anchored = false
  598.  
  599.     for _, attachments in pairs (serverAura:GetChildren()) do
  600.         for _, particles in pairs(attachments:GetChildren()) do
  601.             wait()
  602.             particles.Enabled = false
  603.         end
  604.     end
  605.  
  606.     for _, particles in pairs (bigStarCharge.Attachment:GetChildren()) do
  607.         wait()
  608.         particles.Enabled = false
  609.     end
  610.  
  611.     for _, particles in pairs (serverFinalCharge.Attachment:GetChildren()) do
  612.         wait()
  613.         particles.Enabled = false
  614.     end
  615.  
  616.     for _, particle in pairs (shieldEffect:GetChildren()) do
  617.         wait()
  618.         particle.Enabled = false
  619.     end
  620.     end)
  621.  
  622.     local combineTween = game.TweenService:Create(beginBeamServer, TweenInfo.new(speed), {CFrame = endBeamServer.CFrame})
  623.     combineTween:Play()
  624.    
  625.     turnVisible()
  626.    
  627.  
  628.     combineTween.Completed:Connect(function()
  629.         endBeamServer:Destroy()
  630.         beginBeamServer:Destroy()
  631.         --  Adittional debug --
  632.         beginBeamServer = nil
  633.     end)
  634.  
  635.     wait(speed)
  636.  
  637.    
  638.     local implodePart = serverParts:WaitForChild("Implode"):Clone()
  639.     implodePart.Parent = workspace
  640.     implodePart.Parent = workspaceFolder
  641.     implodePart.CFrame = endBeamServer.CFrame
  642.    
  643.     wait()
  644.    
  645.     implodePart.Attachment.ImplodeEmitter:Emit()
  646.    
  647.     wait()
  648.  
  649.     local outlinerModel = serverParts:WaitForChild("WaterOutliner"):Clone()
  650.     outlinerModel.Parent = workspace
  651.     outlinerModel.Parent = workspaceFolder
  652.     outlinerModel.Center.Size /= 100
  653.     outlinerModel.Color.Size /= 100
  654.     outlinerModel.Outer.Size /= 100
  655.     outlinerModel:MoveTo(endBeamServer.Position)
  656.  
  657.     local splashSound = effects.Sounds.SplashMaximum:Clone()
  658.     splashSound.Parent = outlinerModel.PrimaryPart
  659.     splashSound:Play()
  660.    
  661.     for _, mesh in pairs(outlinerModel:GetChildren()) do
  662.         local increaseSizeTween = game.TweenService:Create(mesh, TweenInfo.new(2), {Size = mesh.Size * 1000, Transparency = 1})
  663.         increaseSizeTween:Play()
  664.         increaseSizeTween.Completed:Connect(function()
  665.             if mesh:FindFirstChildOfClass("ParticleEmitter") then
  666.                 for _, particle in pairs(mesh:GetChildren()) do
  667.                     if particle:IsA("ParticleEmitter") then
  668.                         particle.Enabled = false
  669.                         task.delay(7, function()
  670.                             mesh:Destroy()
  671.                         end)
  672.                     end
  673.                 end
  674.             else
  675.                 --mesh:Destroy()
  676.             end
  677.         end)
  678.     end
  679. end)
  680.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement