Advertisement
Firebirdzz

Example #1.2

Dec 19th, 2024 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.86 KB | None | 0 0
  1. -- Controllable Wave Hunter Script (severSided)
  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.E
  8. local serverParts = serverPartsFolder.Water.E
  9. local tweenService = game:GetService("TweenService")
  10. local workspaceFolder = workspace:WaitForChild("ServerEffectStorage")
  11. local runService = game:GetService("RunService")
  12.  
  13. canBeUsed = false
  14.  
  15. globalDragon = nil
  16. globalDuration = nil
  17.  
  18. debugcd = false
  19.  
  20.  
  21. effects.RemoteEvents.Hold.OnServerEvent:Connect(function(plr, localCFrame)  
  22.     print(localCFrame)
  23.     canBeUsed = true
  24.        
  25.     wait(.5)
  26.    
  27.     local particlesPart = serverParts:WaitForChild("The Wave Hunter"):Clone()
  28.     particlesPart.Parent = plr.Character
  29.     particlesPart.CFrame = plr.Character:WaitForChild("HumanoidRootPart").CFrame
  30.     particlesPart.Orientation = Vector3.new(0,180,0)
  31.     globalDragon = particlesPart
  32.    
  33.     local weld = Instance.new("WeldConstraint")
  34.     weld.Part0 = plr.Character:WaitForChild("HumanoidRootPart")
  35.     weld.Part1 = particlesPart
  36.     weld.Parent = particlesPart
  37.    
  38.     local creationSound = effects:WaitForChild("Sounds"):WaitForChild("Wave Hunter"):Clone()
  39.     creationSound.Parent = plr.Character.HumanoidRootPart
  40.     creationSound:Play()
  41.    
  42.     local chargeSound = effects:WaitForChild("Sounds"):WaitForChild("Charge"):Clone()
  43.     chargeSound.Parent = plr.Character.HumanoidRootPart
  44.     chargeSound:Play()
  45. end)
  46.  
  47. effects.RemoteEvents.Dive.OnServerEvent:Connect(function(plr, localCFrame)
  48.     local function Bezier(t, P0, P1, P2)
  49.         local point = (1-t)^2 * P0 + 2 * (1-t) * t * P1 + t^2 * P2
  50.         return point
  51.     end
  52.  
  53.     local function PerformDive(targetCframe)
  54.         local startPos = plr.Character.HumanoidRootPart.Position
  55.         local controlPoint = (startPos + targetCframe) / 2 + Vector3.new(0, 600, 0)
  56.         local endPos = targetCframe
  57.  
  58.         local duration = 1.1
  59.         globalDuration = duration
  60.         local elapsedTime = 0
  61.  
  62.         local connection
  63.         connection = game:GetService("RunService").Heartbeat:Connect(function(dt)
  64.             elapsedTime = elapsedTime + dt
  65.             local t = elapsedTime / duration
  66.  
  67.             if t > 1 then t = 1 end
  68.  
  69.             if t >= 1 then
  70.                 connection:Disconnect()
  71.                 plr.Character.HumanoidRootPart.Anchored = false
  72.                 plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed * 2
  73.             end
  74.  
  75.             if t < 1 then
  76.                 local newPosition = Bezier(t, startPos, controlPoint, endPos)
  77.                 plr.Character.HumanoidRootPart.CFrame = CFrame.new(newPosition, endPos)
  78.             end
  79.         end)
  80.     end
  81.  
  82.     PerformDive(localCFrame.Position + Vector3.new(0,10,0))
  83.    
  84.     task.delay(globalDuration, function()
  85.         local explosionSound = effects:WaitForChild("Sounds"):WaitForChild("Explode"):Clone()
  86.         explosionSound.Parent = plr.Character.HumanoidRootPart
  87.         explosionSound:Play()
  88.  
  89.         local playerPos = plr.Character.HumanoidRootPart.Position
  90.  
  91.         local outlinerModel = serverParts:WaitForChild("WaterOutliner"):Clone()
  92.         outlinerModel.Parent = workspace
  93.         outlinerModel.Parent = workspaceFolder
  94.         outlinerModel.SkullFacePlayer.Size /= 100
  95.         outlinerModel:MoveTo(playerPos)
  96.  
  97.         local splashSound = effects.Sounds.SplashMaximum:Clone()
  98.         splashSound.Parent = outlinerModel.PrimaryPart
  99.         splashSound:Play()
  100.  
  101.         for _, particleEmitter in pairs(outlinerModel:GetDescendants()) do
  102.             if particleEmitter:IsA("ParticleEmitter") then 
  103.                 local originalSequence = particleEmitter.Size
  104.  
  105.                 local newKeypoints = {}
  106.                 for _, keypoint in ipairs(originalSequence.Keypoints) do
  107.                     table.insert(newKeypoints, NumberSequenceKeypoint.new(keypoint.Time, keypoint.Value * 3, keypoint.Envelope * 3))
  108.                 end
  109.  
  110.                 particleEmitter.Size = NumberSequence.new(newKeypoints)
  111.             end
  112.         end
  113.  
  114.         for _, mesh in pairs(outlinerModel:GetChildren()) do
  115.             local increaseSizeTween = game.TweenService:Create(mesh, TweenInfo.new(5), {Size = mesh.Size * 3000, Transparency = 1})
  116.             increaseSizeTween:Play()
  117.             increaseSizeTween.Completed:Connect(function()
  118.                 if mesh:FindFirstChildOfClass("ParticleEmitter") then
  119.                     for _, particle in pairs(mesh:GetChildren()) do
  120.                         if particle:IsA("ParticleEmitter") then
  121.                             particle.Enabled = false
  122.                             task.delay(7, function()
  123.                                 mesh:Destroy()
  124.                             end)
  125.                         end
  126.                     end
  127.                 end
  128.             end)
  129.         end
  130.     end)
  131.     task.delay(globalDuration, function()
  132.     local dragonTween = game.TweenService:Create(globalDragon, TweenInfo.new(5), {Position = globalDragon.Position - Vector3.new(0, 100, 0)})
  133.     dragonTween:Play()
  134.     dragonTween.Completed:Connect(function()
  135.             globalDragon:Destroy()
  136.         end)
  137.     end)
  138.     task.delay(globalDuration, function()
  139.         local humanoidRootPart = plr.Character.HumanoidRootPart
  140.         local function endAttack()
  141.             humanoidRootPart.Anchored = true
  142.             humanoidRootPart.Velocity = Vector3.zero
  143.             humanoidRootPart.AssemblyLinearVelocity = Vector3.zero
  144.             wait(1)
  145.             humanoidRootPart.Anchored = false
  146.         end
  147.         endAttack()
  148.     end)
  149. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement