Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// VARIABLES //--
- local Cooldowns = {}
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local PromiseModule = require(ReplicatedStorage.Modules.Promise)
- local Cooldown = require(ReplicatedStorage.Modules.Cooldown)
- local Debris = game:GetService("Debris")
- local Red = require(ReplicatedStorage.Modules.Red)
- local ConverseNet = Red.Server("Converse")
- local CooldownNet = Red.Server("Cooldown")
- local StunHandler = require(ReplicatedStorage.Modules.StunModule)
- local Duration = 5
- local CooldownPromise = {}
- local UniversalStun = 3
- local CHECKS = {}
- --// FUNCTION //--
- local cooldownCheck = function(playerName)
- if Cooldown[playerName][script.Name] == false then
- Cooldown[playerName][script.Name] = true
- CooldownNet:Fire(game:GetService("Players"):FindFirstChild(playerName), "Cooldown", {
- script.Name;
- Duration
- })
- CooldownPromise[playerName] = PromiseModule.delay(Duration):andThen(function()
- Cooldown[playerName][script.Name] = false
- end)
- return true
- else
- --[[
- TESTING
- CooldownPromise[playerName]:cancel()
- Cooldown[playerName][script.Name] = false
- ]]
- return false
- end
- end
- return function(player : Player)
- local character = player.Character
- if character:GetAttribute("Stunned") == true then return end
- if character:GetAttribute("Blocking") == true then return end
- if Cooldown[player.Name][script.Name] == true then return end
- --// CHECK CLIENT
- CHECKS[player.Name] = {
- [1] = false;
- [2] = false;
- [3] = false;
- [4] = false;
- [5] = false;
- }
- local converseStage = ConverseNet:Fire(player, "firstClientCheck", {
- script.Parent.Name;
- script.Name;
- "Start";
- })
- ConverseNet:On("firstServerCheck", function(player, target)
- local Hitbox = script.BlueHitbox:Clone()
- Hitbox.Parent = workspace.Effects.Hitbox
- Hitbox:PivotTo(player.Character:GetPivot() + Vector3.new(0, 0, -1))
- Debris:AddItem(Hitbox, 1/15)
- if target ~= false then
- local overlapParams = OverlapParams.new()
- overlapParams.FilterType = Enum.RaycastFilterType.Include
- overlapParams.FilterDescendantsInstances = {target}
- if #workspace:GetPartBoundsInBox(Hitbox.CFrame, Hitbox.Size, overlapParams) > 0 then
- CHECKS[player.Name][1] = target.Parent
- end
- else
- local overlapParams = OverlapParams.new()
- overlapParams.FilterType = Enum.RaycastFilterType.Exclude
- overlapParams.FilterDescendantsInstances = {player.Character}
- local Touching = workspace:GetPartBoundsInBox(Hitbox.CFrame, Vector3.new(2,16,40), overlapParams)
- for index, hit in Touching do
- if hit.Name == "PlayerHitbox" and hit.Parent.Name == "HumanoidRootPart" then
- CHECKS[player.Name][1] = hit.Parent.Parent
- return
- end
- end
- end
- end)
- local Target
- local MovesetStageInitial = PromiseModule.delay(.1):andThen(function()
- if CHECKS[player.Name][1] == false then return end
- if cooldownCheck(player.Name) == false then return end
- -- VFXonPlayer?
- if character:FindFirstChild("Humanoid") then
- StunHandler:addStun(character.Humanoid, 2)
- end
- Target = CHECKS[player.Name][1]
- -- BlueFX
- ConverseNet:FireAll("moveSet", {
- script.Parent.Name;
- script.Name;
- "blueVFX";
- {Target:FindFirstChild("HumanoidRootPart")};
- })
- -- BlueFx
- task.delay(.85, function()
- CHECKS[player.Name][2] = not CHECKS[player.Name][2]
- end)
- end)
- --[[CANCEL]]--
- local CancelPromise = PromiseModule.delay(.7):andThen(function()
- if Target:GetAttribute("Blocking") == true then
- CHECKS[player.Name][2] = true
- end
- end)
- --[[CANCEL]]--
- local MovesetStageMedium = PromiseModule.delay(1):andThen(function()
- if CHECKS[player.Name][2] == false then return end
- CancelPromise:cancel()
- if Target:GetAttribute("Attackable") == false then return end
- if Target:FindFirstChild("Humanoid") then
- StunHandler:addStun(Target.Humanoid, UniversalStun)
- end
- if character:FindFirstChild("Humanoid") then
- StunHandler:addStun(character.Humanoid, 1)
- end
- character:SetAttribute("Attackable", false)
- Target:SetAttribute("Ragdoll", true)
- task.delay(2, function()
- Target:SetAttribute("Ragdoll", false)
- end)
- Target.HumanoidRootPart:SetNetworkOwner(player)
- task.delay(.8, function()
- Target.HumanoidRootPart:SetNetworkOwner(nil)
- end)
- -- blueAttract
- ConverseNet:FireAll("moveSet", {
- script.Parent.Name;
- script.Name;
- "blueBubble";
- {character};
- })
- ConverseNet:Fire(player, "moveSet", {
- script.Parent.Name;
- script.Name;
- "blueAttract";
- {character, Target};
- })
- task.delay(.2, function()
- Target.HumanoidRootPart:SetNetworkOwner(nil)
- if Target:FindFirstChild("Humanoid") then
- Target.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
- end
- end)
- -- blueAttract
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement