Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global_Mod = require(game.ReplicatedStorage.GlobalFunctions)
- Attack_Mod = require(script.Attack)
- CoolDown_Players = {}
- OverAllCooldown = {}
- CoolDown = 0.35
- Reset_Time = 1.5
- tab = {}
- -- // ANIMATIONS \\ --
- attack1 = script.Animations.Attack1
- attack2 = script.Animations.Attack2
- attack3 = script.Animations.Attack3
- attack4 = script.Animations.Attack4
- local module = {}
- function new(char,num)
- if num ~= nil then
- tab[char] = {Value = num,Last = tick()}
- else
- tab[char] = nil
- end
- end
- function Reset(char)
- if tab[char] then
- if tab[char].Value then
- if tab[char].Last then
- if tick() - tab[char].Last > Reset_Time then
- tab[char] = nil
- end
- end
- end
- end
- end
- function module:Attack(player)
- local char = Global_Mod:CharCheck(player)
- local defualt = Global_Mod:DefaultValueCheck(player)
- if not char then return end
- if not defualt then return end
- if OverAllCooldown[char] then return end
- if CoolDown_Players[char] then return end
- local combat = Global_Mod:CombatCheck(player)
- if not combat then return end
- if not Global_Mod:CanAttackCheck(player) then return end
- if not Global_Mod:StunCheck(player) then return end
- Global_Mod:ChangeAndUpdate(player,'CanAttack',false)
- Reset(char)
- defualt.Sprinting.Value = false
- if tab[char] == nil then
- new(char,2)
- char.Humanoid:LoadAnimation(attack1):Play()
- Attack_Mod:Attack(char.RightHand)
- elseif tab[char].Value == 2 then
- new(char,3)
- char.Humanoid:LoadAnimation(attack2):Play()
- Attack_Mod:Attack(char.LeftHand)
- elseif tab[char].Value == 3 then
- new(char,4)
- char.Humanoid:LoadAnimation(attack3):Play()
- Attack_Mod:Attack(char.RightHand)
- elseif tab[char].Value == 4 then
- new(char,nil)
- char.Humanoid:LoadAnimation(attack4):Play()
- Attack_Mod:Attack(char.RightFoot)
- OverAllCooldown[char] = true
- spawn(function()
- wait(1.5)
- OverAllCooldown[char] = false
- end)
- end
- wait(CoolDown)
- Global_Mod:ChangeAndUpdate(player,'CanAttack',true)
- end
- return module
Advertisement
Add Comment
Please, Sign In to add comment