Advertisement
Guest User

Module Handler

a guest
Feb 22nd, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. local m = {}
  2. local ids = script.Animations
  3.  
  4.  
  5. function m.Idle(player, anim)
  6.     local plyr = game.Workspace:WaitForChild(player)
  7.     local hum = plyr:FindFirstChild('Humanoid')
  8.    
  9.     if hum then
  10.         hum.WalkSpeed = 8
  11.         local track = hum:LoadAnimation(ids[anim].Idle)
  12.         track:Play()
  13.     end
  14. end
  15.  
  16. function m.Walk(player, anim, val)
  17.     local plyr = game.Workspace:WaitForChild(player)
  18.     local hum = plyr:FindFirstChild('Humanoid')
  19.     if hum then
  20.         hum.WalkSpeed = 8
  21.         local idletrack = hum:LoadAnimation(ids[anim].Idle)
  22.         local track = hum:LoadAnimation(ids[anim].Walk)            
  23.             if val == 'Walk' then
  24.             idletrack:Stop()
  25.             track:Play()
  26.             else
  27.             if val == 'Idle' then
  28.             track:Stop()
  29.             idletrack:Play()
  30.             end
  31.         end
  32.     end
  33. end
  34.  
  35. function m.Jab(player, anim, cd)
  36.     local plyr = game.Workspace:WaitForChild(player)
  37.     local hum = plyr:FindFirstChild('Humanoid')
  38.    
  39.     if hum then
  40.         local idletrack = hum:LoadAnimation(ids[anim].Idle)
  41.         local track = hum:LoadAnimation(ids[anim].Jab)
  42.         idletrack:Stop()
  43.         track:Play()
  44.         wait(cd)
  45.         track:Stop()
  46.         --idletrack:Play()
  47.     end
  48. end
  49.  
  50. function m.Heavy(player, anim, cd)
  51.     local plyr = game.Workspace:WaitForChild(player)
  52.     local hum = plyr:FindFirstChild('Humanoid')
  53.    
  54.     if hum then
  55.         local idletrack = hum:LoadAnimation(ids[anim].Idle)
  56.         local track = hum:LoadAnimation(ids[anim].Heavy)
  57.         idletrack:Stop()
  58.         track:Play()
  59.         wait(cd)
  60.         track:Stop()
  61.         --idletrack:Play()
  62.     end
  63. end
  64.  
  65. function m.Kick(player, anim, cd)
  66.     local plyr = game.Workspace:WaitForChild(player)
  67.     local hum = plyr:FindFirstChild('Humanoid')
  68.    
  69.     if hum then
  70.         local idletrack = hum:LoadAnimation(ids[anim].Idle)
  71.         local track = hum:LoadAnimation(ids[anim].Kick)
  72.         idletrack:Stop()
  73.         track:Play()
  74.         wait(cd)
  75.         track:Stop()
  76.         --idletrack:Play()
  77.     end
  78. end
  79.  
  80. return m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement