Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SkillHandler = {}
- local SkillsFolder = script:FindFirstChild("Skills")
- local CurrentlyCasting = false
- SkillHandler.Cooldowns = {
- ThunderClap = 5
- }
- function SkillHandler:StartCooldown(Skill)
- local Duration = self.Cooldowns[Skill]
- task.wait(Duration)
- CurrentlyCasting = false
- end
- function SkillHandler:CastSkill(Player, Skill)
- if CurrentlyCasting then return end
- for _,Module in pairs(SkillsFolder:GetDescendants()) do
- if not Module:IsA("ModuleScript") or Module.Name ~= Skill then
- continue
- end
- CurrentlyCasting = true
- Module = require(Module)
- Module:FireSkill(Player)
- self:StartCooldown(Skill)
- end
- end
- return SkillHandler
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement