Advertisement
Guest User

Animation sword script

a guest
Jan 17th, 2020
1,442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. This is the animation Script created by me SamAltrax
  2.  
  3.  
  4.  
  5.  
  6.  
  7. print("Finding player... (This may take a little!)")
  8. wait (1)
  9. print("Found player. Now giving the sword.")
  10. local user = game.Players.LocalPlayer.Backpack
  11. local sword = Instance.new("Tool",user)
  12. print("Gave the player the sword. Enjoy!")
  13. local handle = Instance.new("Part",sword)
  14. local mesh = Instance.new("SpecialMesh",handle)
  15. local DAMAGE = 35
  16. local sound = Instance.new("Sound",handle)
  17. local sound2 = Instance.new("Sound",handle)
  18. sword.Name = "Sword"
  19. script.Parent = sword
  20. script.Name = "SwordScript"
  21. --local animation = Instance.new("Animation",script)
  22.  
  23. --animation.AnimationId = "http://www.roblox.com/Asset?ID=992817684"
  24.  
  25. sound.SoundId = "rbxasset://sounds//swordlunge.wav"
  26. sound.Volume = 3
  27. sound.PlaybackSpeed = 1.17
  28. sound.Name = "Slash"
  29. sound2.SoundId = "rbxasset://sounds//unsheath.wav"
  30. sound2.Volume = 3
  31. sound2.PlaybackSpeed = 0.8
  32. sound2.Volume = 3
  33. sound2.Name = "Unsheath"
  34.  
  35. function unsheathanimation()
  36. sword.GripPos = sword.GripPos + Vector3.new(0,5,0)
  37. for i = 1,5 do
  38. sword.GripPos = sword.GripPos + Vector3.new(0,-1,0)
  39. wait (0.1)
  40. end
  41. end
  42.  
  43. function unsheathsound()
  44. sound2:Play()
  45. end
  46.  
  47. function damage(hit)
  48.  
  49. local h = hit.Parent:FindFirstChild("Humanoid")
  50. if (h ~= nil) then
  51. h:TakeDamage(DAMAGE / 4)
  52. end
  53. end
  54.  
  55. function animate()
  56. --4
  57. sound:Play()
  58. for i = 1,5 do
  59. sword.GripUp = sword.GripUp + Vector3.new(0,0,1)
  60. wait (0)
  61. end
  62. sword.GripUp = sword.GripUp + Vector3.new(0,0,-1)
  63. end
  64. handle.Size = handle.Size + Vector3.new(-4,-1,-2)
  65. handle.Size = handle.Size + Vector3.new(0.6, 3.6, 0.4)
  66. handle.Name = "Handle"
  67.  
  68. mesh.MeshType = "FileMesh"
  69. mesh.MeshId = "http://www.roblox.com/asset/?id=94746028"
  70. mesh.TextureId = "http://www.roblox.com/asset/?ID=94746105"
  71. mesh.Offset = mesh.Offset + Vector3.new(0,1,0)
  72.  
  73. sword.Equipped:connect(unsheathanimation)
  74. sword.Equipped:connect(unsheathsound)
  75. wait(sound2.TimeLength)
  76. sword.Activated:connect(animate)
  77. handle.Touched:connect(damage)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement