Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Controllable Water beam - Ground lock (serverSided)
- local replicatedStorage = game:GetService("ReplicatedStorage")
- local serverPartsFolder = replicatedStorage.ServerParts
- local tool = script.Parent.Parent
- local effectFolder = tool.Effects
- local effects = effectFolder.C
- local serverParts = serverPartsFolder.Water.C
- local tweenService = game:GetService("TweenService")
- local workspaceFolder = workspace:WaitForChild("ServerEffectStorage")
- local configuration = tool.Configuration.C
- numberOneCharge = nil
- numberTwoCharge = nil
- numberThreeCharge = nil
- bigStarCharge = nil
- whirlpoolCFrame = nil
- goal = nil
- heightUpgrade = 0
- characterServer = nil
- serverAura = nil
- serverFinalCharge = nil
- chargeServerCFrame = CFrame.new(0,0,0)
- shieldEffect = nil
- globalHoldSound = nil
- serverExplosion = nil
- serverCounter = 0
- beamCreated = false
- endBeamServer = nil
- beginBeamServer = nil
- debugGlobalBeginBeamLocation = nil
- beamSmoothened = false
- local function turnInvisible()
- for i,v in pairs(characterServer:GetChildren()) do
- if v:IsA("BasePart") or v:IsA("MeshPart") then
- if v.Name ~= "HumanoidRootPart" then
- v.Transparency = 1
- end
- end
- end
- for i,v in pairs(characterServer:GetChildren()) do
- if v:IsA("Accessory") then
- v.Handle.Transparency = 1
- end
- end
- end
- local function turnVisible()
- for i,v in pairs(characterServer:GetChildren()) do
- if v:IsA("BasePart") or v:IsA("MeshPart") then
- if v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0
- end
- end
- end
- for i,v in pairs(characterServer:GetChildren()) do
- if v:IsA("Accessory") then
- v.Handle.Transparency = 0
- end
- end
- end
- effects.RemoteEvents.ChargeUp.OnServerEvent:Connect(function(plr, counter, localCFrame)
- print(plr.Name.." is charging move C. The server measures counter "..counter..". Their current CFrame is:")
- print(localCFrame)
- serverCounter = counter
- print("Creating charge effect now.")
- print("Slowing down user.")
- local humanoid = plr.Character.Humanoid
- local originalWalkSpeed = humanoid.WalkSpeed
- local OriginalJumpPower = humanoid.JumpPower
- humanoid.WalkSpeed = 0
- humanoid.JumpPower = 0
- wait()
- plr.Character.HumanoidRootPart.Anchored = true
- humanoid.WalkSpeed = originalWalkSpeed
- humanoid.JumpPower = OriginalJumpPower
- print("Starting with the sounds.")
- local character = plr.Character
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- local head = character:WaitForChild("Head")
- if counter == 1 or counter == 2 or counter == 3 then
- local chargeSound = effects.Sounds:WaitForChild("Charging Sound"):Clone()
- chargeSound.Parent = workspace
- chargeSound.Parent = workspaceFolder
- chargeSound:Play()
- elseif counter == 4 then
- local chargeSound = effects.Sounds:WaitForChild("BigStarSound"):Clone()
- chargeSound.Parent = workspace
- chargeSound.Parent = workspaceFolder
- chargeSound:Play()
- elseif counter == 5 then
- local chargeSound = effects.Sounds:WaitForChild("FinalChargeSound"):Clone()
- chargeSound.Parent = workspace
- chargeSound.Parent = workspaceFolder
- chargeSound:Play()
- local holdSound = effects.Sounds:WaitForChild("FountainSound"):Clone()
- holdSound.Parent = workspace
- holdSound.Parent = workspaceFolder
- holdSound:Play()
- globalHoldSound = holdSound
- end
- print("Creating the charge Effect.")
- local chargeParticlePart = serverParts.ChargeEffect:Clone()
- chargeParticlePart.Parent = workspace
- chargeParticlePart.Parent = workspaceFolder
- chargeParticlePart.CFrame = localCFrame * CFrame.new(0,2,-3)
- chargeParticlePart.Orientation = Vector3.new(90,0,0)
- chargeParticlePart.Orientation = Vector3.new(chargeParticlePart.Orientation.X, humanoidRootPart.Orientation.Y+180, chargeParticlePart.Orientation.Z)
- chargeServerCFrame = chargeParticlePart.CFrame
- task.delay(1, function()
- chargeParticlePart:Destroy()
- end)
- local particle = chargeParticlePart.Attachment.pulse
- wait()
- particle:Emit()
- print("Stacking Effect stars.")
- if counter == 1 then
- local starEffect = serverParts.ChargeNumber:Clone()
- starEffect.Parent = workspace
- starEffect.Parent = workspaceFolder
- starEffect.CFrame = localCFrame * CFrame.new(5,2,-3)
- numberOneCharge = starEffect
- -- quickly create an explosion for extra effect and animation debugging --
- local explosion = serverParts.Explosion:Clone()
- explosion.Parent = workspace
- explosion.Parent = workspaceFolder
- explosion.CFrame = localCFrame * CFrame.new(0,-5,0)
- for _, particle in pairs (explosion:GetDescendants()) do
- if particle:IsA("ParticleEmitter") then
- particle.Rate = particle.Rate / 3
- end
- end
- serverExplosion = explosion
- local shieldClone = serverParts:WaitForChild("Shield Effect"):Clone()
- shieldClone.Parent = workspace
- shieldClone.Parent = workspaceFolder
- shieldClone.CFrame = localCFrame * CFrame.new(0,0,3)
- local weldC = Instance.new("WeldConstraint")
- weldC.Part0 = character.HumanoidRootPart
- weldC.Part1 = shieldClone
- weldC.Parent = shieldClone
- shieldEffect = shieldClone.Attachment
- local animation = Instance.new("Animation")
- animation.AnimationId = effects.Animations.WaterZSummon.AnimationId
- local playerAnim = plr.Character.Humanoid:LoadAnimation(animation)
- playerAnim:Play()
- elseif counter == 2 then
- local starEffect = serverParts.ChargeNumber:Clone()
- starEffect.Parent = workspace
- starEffect.Parent = workspaceFolder
- starEffect.CFrame = localCFrame * CFrame.new(-5,2,-3)
- task.delay(.25, function()
- for _, particle in pairs (serverExplosion:GetDescendants()) do
- if particle:IsA("ParticleEmitter") then
- particle.Rate = (particle.Rate * 3) / 2
- end
- end
- end)
- numberTwoCharge = starEffect
- shieldEffect.BubbleEffect.Rate *= 2
- shieldEffect.CircleEffect.Rate += 1
- elseif counter == 3 then
- local starEffect = serverParts.ChargeNumber:Clone()
- starEffect.Parent = workspace
- starEffect.Parent = workspaceFolder
- starEffect.CFrame = localCFrame * CFrame.new(0,7,-3)
- shieldEffect.BubbleEffect.Rate += 3
- shieldEffect.CircleEffect.Rate += 1
- task.delay(.25, function()
- for _, particle in pairs (serverExplosion:GetDescendants()) do
- if particle:IsA("ParticleEmitter") then
- particle.Rate = ((particle.Rate * 3) / 2) * 3
- end
- end
- end)
- numberThreeCharge = starEffect
- elseif counter == 4 then
- -- Rework
- --humanoidRootPart.Anchored = false
- -- Rework
- local starEffect = serverParts.ChargeNumber4:Clone()
- starEffect.Parent = workspace
- starEffect.Parent = workspaceFolder
- starEffect.CFrame = localCFrame * CFrame.new(0,15,15)
- bigStarCharge = starEffect
- local tweenInfo = TweenInfo.new(.4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
- local tween = tweenService:Create(plr.Character.HumanoidRootPart, tweenInfo, {CFrame = localCFrame * CFrame.new(0,configuration:WaitForChild("Charge 4 Levitate Height").Value,0)})
- tween:Play()
- local animation = Instance.new("Animation")
- animation.AnimationId = effects.Animations.WaterZCharge.AnimationId
- local playerAnim = plr.Character.Humanoid:LoadAnimation(animation)
- playerAnim:Play()
- local numberOneChargeTween = tweenService:Create(numberOneCharge, tweenInfo, {CFrame = starEffect.CFrame})
- numberOneChargeTween:Play()
- local numberTwoChargeTween = tweenService:Create(numberTwoCharge, tweenInfo, {CFrame = starEffect.CFrame})
- numberTwoChargeTween:Play()
- local numberThreeChargeTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = starEffect.CFrame})
- numberThreeChargeTween:Play()
- task.delay(.25, function()
- for _, particle in pairs (serverExplosion:GetDescendants()) do
- if particle:IsA("ParticleEmitter") then
- particle.Rate = 0
- end
- end
- wait(3)
- serverExplosion:Destroy()
- end)
- elseif counter == 5 then
- task.delay(.5, function()
- humanoidRootPart.Anchored = true
- end)
- numberOneCharge:Destroy()
- numberTwoCharge:Destroy()
- numberThreeCharge:Destroy()
- local whirlpoolEffect = serverParts.FinalCharge:Clone()
- whirlpoolEffect.Parent = workspace
- whirlpoolEffect.Parent = workspaceFolder
- whirlpoolEffect.CFrame = localCFrame * CFrame.new(0,20,-3)
- whirlpoolEffect.Orientation = chargeParticlePart.Orientation
- whirlpoolCFrame = whirlpoolEffect.CFrame
- serverFinalCharge = whirlpoolEffect
- local tweenInfo = TweenInfo.new(.8, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
- local tween = tweenService:Create(plr.Character.HumanoidRootPart, tweenInfo, {CFrame = localCFrame * CFrame.new(0,configuration:WaitForChild("Charge 5 Levitate Height").Value,0)})
- tween:Play()
- local aura = serverParts.Aura:Clone()
- aura.Parent = workspace
- aura.Parent = workspaceFolder
- aura.CFrame = localCFrame * CFrame.new(0,20,0)
- serverAura = aura
- local bigStarTween = tweenService:Create(bigStarCharge, tweenInfo, {CFrame = whirlpoolEffect.CFrame})
- bigStarTween:Play()
- print("Firing a beam once started.")
- end
- print(serverCounter)
- end)
- effects.RemoteEvents.StartAttack.OnServerEvent:Connect(function(plr, counter, localCFrame)
- print("Starting attack at servercounter: "..serverCounter)
- plr.Character.Humanoid.WalkSpeed = 16
- warn("Measured final server counter: "..counter..".")
- wait()
- if counter == 1 then
- print("Attacking at counter 1.")
- for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
- track:Stop()
- end
- plr.Character.HumanoidRootPart.Anchored = false
- task.delay(configuration:WaitForChild("Charge 1 Duration").Value, function()
- for _, particle in pairs (shieldEffect:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- wait(shieldEffect.Attachment.shieldOutline.Lifetime)
- shieldEffect:Destroy()
- numberOneCharge:Destroy()
- end)
- elseif counter == 2 then
- for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
- track:Stop()
- end
- print("Attacking at counter 2.")
- plr.Character.HumanoidRootPart.Anchored = false
- task.delay(configuration:WaitForChild("Charge 2 Duration").Value, function()
- for _, particle in pairs (shieldEffect:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberTwoCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- wait(shieldEffect.Attachment.shieldOutline.Lifetime)
- shieldEffect:Destroy()
- numberOneCharge:Destroy()
- numberTwoCharge:Destroy()
- end)
- elseif counter == 3 then
- for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
- track:Stop()
- end
- print("Attacking at counter 3.")
- plr.Character.HumanoidRootPart.Anchored = false
- task.delay(configuration:WaitForChild("Charge 3 Duration").Value, function()
- for _, particle in pairs (shieldEffect:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberOneCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberTwoCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- for _, particle in pairs (numberThreeCharge.Attachment:GetChildren()) do
- particle.Enabled = false
- end
- wait(shieldEffect.Attachment.shieldOutline.Lifetime)
- shieldEffect:Destroy()
- numberOneCharge:Destroy()
- numberTwoCharge:Destroy()
- numberThreeCharge:Destroy()
- end)
- end
- end)
- -- Script for charge 4 --
- effects.RemoteEvents.StartMiniBeam.OnServerEvent:Connect(function(plr, TargetCFrame, localCFrame)
- print("Getting location...")
- print(TargetCFrame)
- -- globalHoldSound:Destroy()
- if beamCreated == false then
- beamCreated = true
- for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
- track:Stop()
- end
- characterServer = plr.Character
- turnInvisible()
- print("Attacking at counter 4. This creates a small water beam.")
- local waterBeam = serverParts.SmallWaterBeam:Clone()
- waterBeam.Parent = workspace
- waterBeam.Parent = workspaceFolder
- local beginBeam = waterBeam.StartPart
- local endBeam = waterBeam.EndPart
- endBeamServer = endBeam
- beginBeamServer = beginBeam
- beginBeam.CFrame = plr.Character.HumanoidRootPart.CFrame
- endBeam.CFrame = localCFrame
- local explosionSound = effects.Sounds.SmallBeamSound:Clone()
- explosionSound.Parent = workspace
- explosionSound.Parent = waterBeam.EndPart
- explosionSound:Play()
- local castSound = effects.Sounds.BeginPartSound:Clone()
- castSound.Parent = workspace
- castSound.Parent = waterBeam.StartPart
- castSound:Play()
- local tweenInfo = TweenInfo.new(.4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
- local numberOneChargeTween = tweenService:Create(numberOneCharge, tweenInfo, {CFrame = beginBeam.CFrame})
- numberOneChargeTween:Play()
- local numberTwoChargeTween = tweenService:Create(numberTwoCharge, tweenInfo, {CFrame = beginBeam.CFrame})
- numberTwoChargeTween:Play()
- local numberThreeChargeTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = beginBeam.CFrame})
- numberThreeChargeTween:Play()
- local bigStarTween = tweenService:Create(numberThreeCharge, tweenInfo, {CFrame = beginBeam.CFrame})
- bigStarTween:Play()
- end
- debugGlobalBeginBeamLocation = beginBeamServer
- debugGlobalBeginBeamLocation.CFrame = plr.Character.HumanoidRootPart.CFrame
- endBeamServer.CFrame = TargetCFrame
- end)
- effects.RemoteEvents.EndMiniBeam.OnServerEvent:Connect(function(plr)
- -- Reset the beamcreated variable. --
- beamCreated = false
- plr.Character.HumanoidRootPart.Anchored = false
- task.spawn(function()
- for _, particles in pairs (bigStarCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particles in pairs (numberOneCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particles in pairs (numberTwoCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particles in pairs (numberThreeCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particle in pairs (shieldEffect:GetChildren()) do
- wait()
- particle.Enabled = false
- end
- end)
- local combineTween = game.TweenService:Create(beginBeamServer, TweenInfo.new(1), {CFrame = endBeamServer.CFrame})
- combineTween:Play()
- turnVisible()
- combineTween.Completed:Connect(function()
- endBeamServer:Destroy()
- beginBeamServer:Destroy()
- end)
- wait(.8)
- local outlinerModel = serverParts:WaitForChild("WaterOutliner"):Clone()
- outlinerModel.Parent = workspace
- outlinerModel.Parent = workspaceFolder
- outlinerModel.Center.Size /= 100
- outlinerModel.Color.Size /= 100
- outlinerModel.Outer.Size /= 100
- outlinerModel:MoveTo(endBeamServer.Position)
- local splashSound = effects.Sounds.Splash:Clone()
- splashSound.Parent = outlinerModel.PrimaryPart
- splashSound:Play()
- for _, mesh in pairs(outlinerModel:GetChildren()) do
- local increaseSizeTween = game.TweenService:Create(mesh, TweenInfo.new(2), {Size = mesh.Size * 200, Transparency = 1})
- increaseSizeTween:Play()
- increaseSizeTween.Completed:Connect(function()
- if mesh:FindFirstChildOfClass("ParticleEmitter") then
- for _, particle in pairs(mesh:GetChildren()) do
- if particle:IsA("ParticleEmitter") then
- particle.Enabled = false
- task.delay(5, function()
- mesh:Destroy()
- end)
- end
- end
- else
- mesh:Destroy()
- end
- end)
- end
- end)
- -- Script for charge 5 --
- effects.RemoteEvents.StartBeam.OnServerEvent:Connect(function(plr, TargetCFrame)
- print("Getting location...")
- print(TargetCFrame)
- globalHoldSound:Destroy()
- if beamCreated == false then
- beamCreated = true
- for _, track in pairs (plr.character.Humanoid:GetPlayingAnimationTracks()) do
- track:Stop()
- end
- characterServer = plr.Character
- turnInvisible()
- print("Attacking at counter 5.")
- local waterBeam = serverParts.WaterBeam:Clone()
- waterBeam.Parent = workspace
- waterBeam.Parent = workspaceFolder
- local beginBeam = waterBeam.StartPart
- local endBeam = waterBeam.EndPart
- local vortex = endBeam.Vortex
- vortex.Parent = endBeam:WaitForChild("Attachment")
- --vortex.Parent = workspaceFolder:WaitForChild("Attachmenter")
- endBeamServer = endBeam
- beginBeamServer = beginBeam
- beginBeam.CFrame = whirlpoolCFrame
- endBeam.CFrame = whirlpoolCFrame
- local explosionSound = effects.Sounds.Explosion:Clone()
- explosionSound.Parent = workspace
- explosionSound.Parent = waterBeam.EndPart
- explosionSound:Play()
- local castSound = effects.Sounds.BeginPartSound:Clone()
- castSound.Parent = workspace
- castSound.Parent = waterBeam.StartPart
- castSound:Play()
- --[[ task.spawn(function()
- local newPart = Instance.new("Part")
- newPart.Name = "Diffuse"
- newPart.Anchored = true
- newPart.Size = Vector3.new(0.1,0.1,0.1)
- newPart.Transparency = 1
- newPart.Parent = workspace
- newPart.Parent = workspaceFolder
- newPart.CFrame = beginBeamServer.CFrame
- -- Make the endBeamPart's attachment attached to the new part. --
- local attachment = endBeamServer:WaitForChild("Attachment")
- attachment.Parent = newPart
- -- Now the part will tween from the startbeam to the endbeam --
- local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.In, 0, false, 0)
- local tween = game.TweenService:Create(newPart, tweenInfo, {CFrame = TargetCFrame})
- tween:Play()
- tween.Completed:Connect(function()
- attachment.Parent = endBeamServer
- vortex.Parent = endBeamServer
- newPart:Destroy()
- end)
- end) ]]
- end
- debugGlobalBeginBeamLocation = beginBeamServer
- debugGlobalBeginBeamLocation.CFrame = plr.Character.HumanoidRootPart.CFrame
- endBeamServer.CFrame = TargetCFrame
- end)
- effects.RemoteEvents.EndBeam.OnServerEvent:Connect(function(plr)
- -- Reset the beamcreated variable. --
- beamCreated = false
- local distance = (plr.Character.HumanoidRootPart.Position - endBeamServer.Position).Magnitude
- local speed = distance / 100
- task.spawn(function()
- if plr.Character.HumanoidRootPart:FindFirstChild("FountainSound") then
- local volume = plr.Character.HumanoidRootPart.FountainSound.Volume
- local onePercent = volume / 100 warn(onePercent)
- for i = 1,100 do
- wait()
- plr.Character.HumanoidRootPart.FountainSound.Volume -= onePercent
- end
- plr.Character.HumanoidRootPart.FountainSound:Destroy()
- end
- plr.Character.HumanoidRootPart.Anchored = false
- for _, attachments in pairs (serverAura:GetChildren()) do
- for _, particles in pairs(attachments:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- end
- for _, particles in pairs (bigStarCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particles in pairs (serverFinalCharge.Attachment:GetChildren()) do
- wait()
- particles.Enabled = false
- end
- for _, particle in pairs (shieldEffect:GetChildren()) do
- wait()
- particle.Enabled = false
- end
- end)
- local combineTween = game.TweenService:Create(beginBeamServer, TweenInfo.new(speed), {CFrame = endBeamServer.CFrame})
- combineTween:Play()
- turnVisible()
- combineTween.Completed:Connect(function()
- endBeamServer:Destroy()
- beginBeamServer:Destroy()
- -- Adittional debug --
- beginBeamServer = nil
- end)
- wait(speed)
- local implodePart = serverParts:WaitForChild("Implode"):Clone()
- implodePart.Parent = workspace
- implodePart.Parent = workspaceFolder
- implodePart.CFrame = endBeamServer.CFrame
- wait()
- implodePart.Attachment.ImplodeEmitter:Emit()
- wait()
- local outlinerModel = serverParts:WaitForChild("WaterOutliner"):Clone()
- outlinerModel.Parent = workspace
- outlinerModel.Parent = workspaceFolder
- outlinerModel.Center.Size /= 100
- outlinerModel.Color.Size /= 100
- outlinerModel.Outer.Size /= 100
- outlinerModel:MoveTo(endBeamServer.Position)
- local splashSound = effects.Sounds.SplashMaximum:Clone()
- splashSound.Parent = outlinerModel.PrimaryPart
- splashSound:Play()
- for _, mesh in pairs(outlinerModel:GetChildren()) do
- local increaseSizeTween = game.TweenService:Create(mesh, TweenInfo.new(2), {Size = mesh.Size * 1000, Transparency = 1})
- increaseSizeTween:Play()
- increaseSizeTween.Completed:Connect(function()
- if mesh:FindFirstChildOfClass("ParticleEmitter") then
- for _, particle in pairs(mesh:GetChildren()) do
- if particle:IsA("ParticleEmitter") then
- particle.Enabled = false
- task.delay(7, function()
- mesh:Destroy()
- end)
- end
- end
- else
- --mesh:Destroy()
- end
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement