Advertisement
ProIsEpix_Dev

One (SERVER)

Jan 11th, 2025
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.77 KB | None | 0 0
  1. --// VARIABLES //--
  2. local Cooldowns = {}
  3. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  4. local PromiseModule = require(ReplicatedStorage.Modules.Promise)
  5. local Cooldown = require(ReplicatedStorage.Modules.Cooldown)
  6. local Debris = game:GetService("Debris")
  7.  
  8.  
  9. local Red = require(ReplicatedStorage.Modules.Red)
  10. local ConverseNet = Red.Server("Converse")
  11. local CooldownNet = Red.Server("Cooldown")
  12.  
  13. local StunHandler = require(ReplicatedStorage.Modules.StunModule)
  14.  
  15. local Duration = 5
  16. local CooldownPromise = {}
  17. local UniversalStun = 3
  18.  
  19. local CHECKS = {}
  20.  
  21. --// FUNCTION //--
  22. local cooldownCheck = function(playerName)
  23.     if Cooldown[playerName][script.Name] == false then
  24.         Cooldown[playerName][script.Name] = true
  25.         CooldownNet:Fire(game:GetService("Players"):FindFirstChild(playerName), "Cooldown", {
  26.             script.Name;
  27.             Duration
  28.         })
  29.         CooldownPromise[playerName] = PromiseModule.delay(Duration):andThen(function()
  30.             Cooldown[playerName][script.Name] = false
  31.         end)
  32.         return true
  33.     else
  34.         --[[
  35.         TESTING
  36.         CooldownPromise[playerName]:cancel()
  37.         Cooldown[playerName][script.Name] = false
  38.         ]]
  39.         return false
  40.     end
  41. end
  42.  
  43. return function(player : Player)
  44.     local character     = player.Character
  45.     if character:GetAttribute("Stunned") == true then return end
  46.     if character:GetAttribute("Blocking") == true then return end
  47.     if Cooldown[player.Name][script.Name] == true then return end
  48.    
  49.     --// CHECK CLIENT
  50.     CHECKS[player.Name] = {
  51.         [1] = false;
  52.         [2] = false;
  53.         [3] = false;
  54.         [4] = false;
  55.         [5] = false;
  56.     }
  57.     local converseStage = ConverseNet:Fire(player, "firstClientCheck", {
  58.         script.Parent.Name;
  59.         script.Name;
  60.         "Start";
  61.     })
  62.     ConverseNet:On("firstServerCheck", function(player, target)
  63.         local Hitbox = script.BlueHitbox:Clone()
  64.         Hitbox.Parent = workspace.Effects.Hitbox
  65.         Hitbox:PivotTo(player.Character:GetPivot() + Vector3.new(0, 0, -1))
  66.        
  67.         Debris:AddItem(Hitbox, 1/15)
  68.        
  69.         if target ~= false then
  70.             local overlapParams = OverlapParams.new()
  71.             overlapParams.FilterType = Enum.RaycastFilterType.Include
  72.             overlapParams.FilterDescendantsInstances = {target}
  73.  
  74.             if #workspace:GetPartBoundsInBox(Hitbox.CFrame, Hitbox.Size, overlapParams) > 0 then
  75.                 CHECKS[player.Name][1] = target.Parent
  76.             end
  77.         else
  78.             local overlapParams = OverlapParams.new()
  79.             overlapParams.FilterType = Enum.RaycastFilterType.Exclude
  80.             overlapParams.FilterDescendantsInstances = {player.Character}
  81.            
  82.             local Touching = workspace:GetPartBoundsInBox(Hitbox.CFrame, Vector3.new(2,16,40), overlapParams)
  83.            
  84.             for index, hit in Touching do
  85.                 if hit.Name == "PlayerHitbox" and hit.Parent.Name == "HumanoidRootPart" then
  86.                     CHECKS[player.Name][1] = hit.Parent.Parent
  87.                     return
  88.                 end
  89.             end
  90.         end
  91.     end)
  92.     local Target
  93.     local MovesetStageInitial = PromiseModule.delay(.1):andThen(function()
  94.         if CHECKS[player.Name][1] == false then return end
  95.         if cooldownCheck(player.Name) == false then return end
  96.        
  97.         -- VFXonPlayer?
  98.         if character:FindFirstChild("Humanoid") then
  99.             StunHandler:addStun(character.Humanoid, 2)
  100.         end
  101.        
  102.         Target = CHECKS[player.Name][1]
  103.        
  104.         -- BlueFX
  105.         ConverseNet:FireAll("moveSet", {
  106.             script.Parent.Name;
  107.             script.Name;
  108.             "blueVFX";
  109.             {Target:FindFirstChild("HumanoidRootPart")};
  110.         })
  111.         -- BlueFx
  112.        
  113.         task.delay(.85, function()
  114.             CHECKS[player.Name][2] = not CHECKS[player.Name][2]
  115.         end)
  116.     end)
  117.    
  118.     --[[CANCEL]]--
  119.     local CancelPromise = PromiseModule.delay(.7):andThen(function()
  120.         if Target:GetAttribute("Blocking") == true then
  121.             CHECKS[player.Name][2] = true
  122.         end
  123.     end)
  124.  
  125.     --[[CANCEL]]--
  126.    
  127.     local MovesetStageMedium = PromiseModule.delay(1):andThen(function()
  128.         if CHECKS[player.Name][2] == false then return end
  129.         CancelPromise:cancel()
  130.         if Target:GetAttribute("Attackable") == false then return end
  131.        
  132.         if Target:FindFirstChild("Humanoid") then
  133.             StunHandler:addStun(Target.Humanoid, UniversalStun)
  134.         end
  135.         if character:FindFirstChild("Humanoid") then
  136.             StunHandler:addStun(character.Humanoid, 1)
  137.         end
  138.         character:SetAttribute("Attackable", false)
  139.         Target:SetAttribute("Ragdoll", true)
  140.         task.delay(2, function()
  141.             Target:SetAttribute("Ragdoll", false)
  142.         end)
  143.         Target.HumanoidRootPart:SetNetworkOwner(player)
  144.         task.delay(.8, function()
  145.             Target.HumanoidRootPart:SetNetworkOwner(nil)
  146.         end)
  147.         -- blueAttract
  148.         ConverseNet:FireAll("moveSet", {
  149.             script.Parent.Name;
  150.             script.Name;
  151.             "blueBubble";
  152.             {character};
  153.         })
  154.         ConverseNet:Fire(player, "moveSet", {
  155.             script.Parent.Name;
  156.             script.Name;
  157.             "blueAttract";
  158.             {character, Target};
  159.         })
  160.         task.delay(.2, function()
  161.             Target.HumanoidRootPart:SetNetworkOwner(nil)
  162.             if Target:FindFirstChild("Humanoid") then
  163.                 Target.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  164.             end
  165.         end)
  166.         -- blueAttract
  167.        
  168.     end)
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement