D_rawest16

Untitled

Mar 20th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. Global_Mod = require(game.ReplicatedStorage.GlobalFunctions)
  2. Attack_Mod = require(script.Attack)
  3. CoolDown_Players = {}
  4. OverAllCooldown = {}
  5. CoolDown = 0.35
  6. Reset_Time = 1.5
  7. tab = {}
  8. -- // ANIMATIONS \\ --
  9. attack1 = script.Animations.Attack1
  10. attack2 = script.Animations.Attack2
  11. attack3 = script.Animations.Attack3
  12. attack4 = script.Animations.Attack4
  13.  
  14. local module = {}
  15. function new(char,num)
  16.     if num ~= nil then
  17.         tab[char] = {Value = num,Last = tick()}
  18.     else
  19.         tab[char] = nil
  20.     end
  21. end
  22. function Reset(char)
  23.     if tab[char] then
  24.         if tab[char].Value then
  25.             if tab[char].Last then
  26.                 if tick() - tab[char].Last > Reset_Time then
  27.                     tab[char] = nil
  28.                 end
  29.             end
  30.         end
  31.     end
  32. end
  33.  
  34. function module:Attack(player)
  35.    
  36.     local char = Global_Mod:CharCheck(player)
  37.     local defualt = Global_Mod:DefaultValueCheck(player)
  38.    
  39.     if not char then return end
  40.     if not defualt then return end
  41.     if OverAllCooldown[char] then return end
  42.     if CoolDown_Players[char] then return end
  43.    
  44.     local combat = Global_Mod:CombatCheck(player)
  45.     if not combat then return end
  46.     if not Global_Mod:CanAttackCheck(player) then return end
  47.     if not Global_Mod:StunCheck(player) then return end
  48.    
  49.     Global_Mod:ChangeAndUpdate(player,'CanAttack',false)
  50.     Reset(char)
  51.    
  52.     defualt.Sprinting.Value = false
  53.    
  54.     if tab[char] == nil then
  55.         new(char,2)
  56.         char.Humanoid:LoadAnimation(attack1):Play()
  57.         Attack_Mod:Attack(char.RightHand)
  58.     elseif tab[char].Value == 2 then
  59.         new(char,3)
  60.         char.Humanoid:LoadAnimation(attack2):Play()
  61.         Attack_Mod:Attack(char.LeftHand)
  62.     elseif tab[char].Value == 3 then
  63.         new(char,4)
  64.         char.Humanoid:LoadAnimation(attack3):Play()
  65.         Attack_Mod:Attack(char.RightHand)
  66.     elseif tab[char].Value == 4 then
  67.         new(char,nil)
  68.        
  69.         char.Humanoid:LoadAnimation(attack4):Play()
  70.         Attack_Mod:Attack(char.RightFoot)
  71.         OverAllCooldown[char] = true
  72.         spawn(function()
  73.             wait(1.5)
  74.             OverAllCooldown[char] = false
  75.         end)
  76.     end
  77.    
  78.     wait(CoolDown)
  79.     Global_Mod:ChangeAndUpdate(player,'CanAttack',true)
  80. end
  81. return module
Advertisement
Add Comment
Please, Sign In to add comment