Advertisement
Nutgear

Sword Script

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