SebTDZ

Grab

Jun 30th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. local Grab = Instance.new("Tool", owner.Backpack)
  2. Grab.Name = "Grab"
  3.  
  4. local P = Instance.new("Part", Grab)
  5. P.Name = "Handle"
  6. P.Size = Vector3.new(1,1,1)
  7. P.Transparency = 1
  8. P.CanCollide = false
  9.  
  10. local S = Instance.new("Part", Grab)
  11. S.Name = "S"
  12. S.Size = Vector3.new(5.5,5,5.5)
  13. S.Transparency = 0.5
  14. S.CanCollide = false
  15. S.Shape = Enum.PartType.Cylinder
  16. S.TopSurface = Enum.SurfaceType.Smooth
  17. S.BottomSurface = Enum.SurfaceType.Smooth
  18.  
  19. local W1 = Instance.new("Weld", Grab)
  20. W1.Name = "W1"
  21. W1.Part0 = P
  22. W1.Part1 = S
  23. W1.C0 = CFrame.fromOrientation(0,0,80.1) + Vector3.new(0,0,-5)
  24.  
  25. local P2 = Instance.new("Part", Grab)
  26. P2.Name = "Handle"
  27. P2.Size = Vector3.new(1,1,1)
  28. P2.Transparency = 1
  29. P2.CanCollide = false
  30.  
  31. local W2 = Instance.new("Weld", Grab)
  32. W2.Name = "W2"
  33. W2.Part0 = S
  34. W2.Part1 = P2
  35. W2.C0 = CFrame.fromOrientation(0,0,-80.1) + Vector3.new(0,0,-1)
  36.  
  37. local plr = Instance.new("ObjectValue", Grab)
  38. plr.Name = "plr"
  39.  
  40. db = false
  41.  
  42. S.Touched:Connect(function(c)
  43.     if db then
  44.         if c.Parent:FindFirstChild("HumanoidRootPart") then
  45.             plr.Value = c.Parent
  46.         elseif c.Parent:FindFirstChild("Torso") then
  47.             plr.Value = c.Parent
  48.         elseif c.Parent:FindFirstChild("UpperTorso") then
  49.             plr.Value = c.Parent
  50.         end
  51.     end
  52. end)
  53.  
  54. Grab.Activated:Connect(function()
  55.     if plr.Value == nil then
  56.         db = true
  57.     else
  58.         plr.Value = nil
  59.     end
  60. end)
  61.  
  62. Grab.Deactivated:Connect(function()
  63.     db = false
  64. end)
  65.  
  66. while true do
  67.     if plr.Value == nil then
  68.         local a = 1
  69.     else
  70.         if plr.Value:FindFirstChild("HumanoidRootPart") then
  71.             plr.Value:FindFirstChild("HumanoidRootPart").CFrame = P2.CFrame
  72.         elseif plr.Value:FindFirstChild("Torso") then
  73.             plr.Value:FindFirstChild("Torso").CFrame = P2.CFrame
  74.         elseif plr.Value:FindFirstChild("UpperTorso") then
  75.             plr.Value:FindFirstChild("UpperTorso").CFrame = P2.CFrame
  76.         end
  77.     end
  78.     wait(0.001)
  79. end
Add Comment
Please, Sign In to add comment