Advertisement
icy-desudesu

alternate

Aug 18th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. script.Parent = game.ReplicatedStorage.Tool
  2. repeat wait() until game.Players.LocalPlayer
  3.  
  4. Player = game.Players.LocalPlayer
  5. char = Player.Character
  6. h = char.Humanoid
  7. tool = script.Parent
  8. local user
  9. local range = 10
  10. grab = false
  11.  
  12. animTrack1 = nil
  13. damselAnimTrack = nil
  14.  
  15. tool.Equipped:connect(function(mouse)
  16. mouse.Button1Down:connect(function()
  17. if grab == true then return end
  18. local ray = Ray.new(tool.Handle.CFrame.p, (mouse.hit.p - tool.Handle.CFrame.p).unit*range)
  19. local hit, position = game.Workspace:FindPartOnRay(ray, user)
  20. local humanoid = hit and hit.Parent:FindFirstChild("Humanoid")
  21. if humanoid and humanoid ~= char.Humanoid then
  22. grab = true
  23. local damselChar = humanoid.Parent
  24. humanoid.PlatformStand = true
  25. local newHandle = tool.Handle:Clone()
  26. newHandle.Parent = char
  27. local newWeld = Instance.new("ManualWeld", char)
  28. newWeld.Part0 = newHandle
  29. newWeld.Part1 = char.Torso
  30. local weld = Instance.new("ManualWeld", char)
  31. weld.Part0 = newHandle
  32. weld.Part1 = damselChar.HumanoidRootPart
  33. weld.C0 = CFrame.new(1.6, .3, -1.8)
  34. animTrack1 = h:LoadAnimation(tool.damsel1)
  35. animTrack1:Play()
  36. damselAnimTrack = humanoid:LoadAnimation(tool.damsel2)
  37. damselAnimTrack:Play()
  38. tool.Unequipped:connect(function()
  39. humanoid.PlatformStand = false
  40. grab = false
  41. animTrack1:Stop()
  42. damselAnimTrack:Stop()
  43. weld:Destroy()
  44. newHandle:Destroy()
  45. newWeld:Destroy()
  46. end)
  47. end
  48. end)
  49. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement