HowToRoblox

AnimationScript

Oct 28th, 2019
4,240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.42 KB | None | 0 0
  1. local CanAttack = true
  2.  
  3. local Sound = script.Parent:WaitForChild("SwordSwing")
  4.  
  5. script.Parent.Activated:Connect(function()
  6.  
  7.     local AttackAnim = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
  8.    
  9.    
  10.     if CanAttack == true then
  11.    
  12.         AttackAnim:Play()
  13.    
  14.         CanAttack = false
  15.        
  16.         Sound:Play()
  17.    
  18.         wait(1)
  19.        
  20.         AttackAnim:Stop()
  21.        
  22.         CanAttack = true
  23.        
  24.         script.Parent.CanDamage.Value = true   
  25.     end
  26. end)
Add Comment
Please, Sign In to add comment