Advertisement
daaa

Untitled

Jun 19th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. --Made by Stickmasterluke
  2.  
  3.  
  4. sp=script.Parent
  5.  
  6.  
  7. local reloading=sp:WaitForChild("Reloading")
  8. local down=sp:WaitForChild("MouseDown")
  9. local runanim=sp:WaitForChild("RunAnim")
  10.  
  11. animspeed=1.2 --lower number is slower
  12. equipspeed=1.5
  13. originalgrip=CFrame.new(0,-1,.1)
  14. currentgrip=originalgrip
  15. function swordUp()
  16. currentgrip=originalgrip
  17. sp.Grip=currentgrip
  18. end
  19. function swordOut()
  20. currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
  21. sp.Grip=currentgrip
  22. end
  23. function spinsword(spintime)
  24. delay(0,function()
  25. local startspin=tick()
  26. local endspin=startspin+spintime
  27. while tick()<endspin do
  28. sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
  29. wait()
  30. end
  31. sp.Grip=currentgrip
  32. end)
  33. end
  34.  
  35. function update(mouse)
  36. if mouse~=nil then
  37. if reloading.Value then
  38. mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
  39. else
  40. mouse.Icon="rbxasset://textures\\GunCursor.png"
  41. end
  42. end
  43. end
  44.  
  45. runanim.Changed:connect(function()
  46. local h=sp.Parent:FindFirstChild("Humanoid")
  47. local t=sp.Parent:FindFirstChild("Torso")
  48. local anim=sp:FindFirstChild(runanim.Value)
  49. if anim and t and h then
  50. local theanim=h:LoadAnimation(anim)
  51. if theanim and h.Health>0 then
  52. theanim:Play(nil,nil,animspeed)
  53. end
  54. end
  55. end)
  56.  
  57.  
  58. function Equipped(mouse)
  59. if mouse~=nil then
  60. update(mouse)
  61. reloading.Changed:connect(function()
  62. update(mouse)
  63. end)
  64. mouse.Button1Down:connect(function()
  65. down.Value=true
  66. end)
  67. mouse.Button1Up:connect(function()
  68. down.Value=false
  69. end)
  70. local h=sp.Parent:FindFirstChild("Humanoid")
  71. local t=sp.Parent:FindFirstChild("Torso")
  72. if t and h then
  73. local equipanim=sp:FindFirstChild("Equip")
  74. if equipanim~=nil then
  75. local EquipAnim=h:LoadAnimation(equipanim)
  76. if EquipAnim and h.Health>0 then
  77. EquipAnim:Play(nil,nil,equipspeed)
  78. end
  79. end
  80. local holdanim=sp:FindFirstChild("Hold")
  81. if holdanim~=nil then
  82. if HoldAnim then
  83. HoldAnim:Stop()
  84. end
  85. HoldAnim=h:LoadAnimation(holdanim)
  86. if HoldAnim and h.Health>0 then
  87. HoldAnim:Play()
  88. end
  89. end
  90. end
  91. end
  92. end
  93.  
  94. function Unequipped()
  95. down.Value=false
  96. if HoldAnim then
  97. HoldAnim:Stop()
  98. end
  99. end
  100.  
  101. sp.Equipped:connect(Equipped)
  102. sp.Unequipped:connect(Unequipped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement