Advertisement
Overhaleren

Telekenesis 2

May 23rd, 2016
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. --[[
  2. R: make random object
  3. F: shoot grabbed objects
  4. E: more distance
  5. Q: less distance
  6. ]]
  7. local char=game.Players.LocalPlayer.Character
  8. local mouse=game.Players.LocalPlayer:GetMouse()
  9. local weld=Instance.new("Weld",char)
  10. local dist=-4
  11. local enlarging
  12. local enshorting
  13. local tograb
  14. weld.Part0=char.Torso
  15. weld.Part1=char["Right Arm"]
  16. game:service("RunService").RenderStepped:connect(function()
  17. weld.C0=char.Torso.CFrame:inverse()*CFrame.new((char.Torso.CFrame*CFrame.new(1.5,.5,0)).p,mouse.Hit.p)*CFrame.new(0,0,-.5)*CFrame.Angles(math.rad(90),0,0)
  18. end)
  19. mouse.Button1Down:connect(function()
  20. if mouse.Target~=nil and tograb==nil then
  21. if mouse.Target.className=="Part" and mouse.Target.Name~="Base" then
  22. tograb=mouse.Target
  23. tograb.Anchored=true
  24. tograb.CanCollide=true
  25. tograb.Parent=Workspace
  26. end
  27. else
  28. if tograb~=nil then
  29. tograb.Anchored=false
  30. tograb=nil
  31. end
  32. end
  33. end)
  34. mouse.KeyDown:connect(function(key)
  35. if string.lower(key)=="r" then
  36. pcall(function()
  37. local materials={
  38. "Plastic","SmoothPlastic","Wood",
  39. "Marble","Slate","Concrete",
  40. "Granite","Brick","Pebble",
  41. "CorrodedMetal","DiamondPlate","Foil",
  42. "Grass","Sand","Fabric","Ice"
  43. }
  44. local prt=Instance.new("Part",Workspace)
  45. prt.FormFactor="Custom"
  46. prt.Size=Vector3.new(math.random(0.4,3),math.random(0.4,3),math.random(0.4,3))
  47. prt.Material=materials[math.random(1,#materials)]
  48. prt.BrickColor=BrickColor.new(Color3.new(math.random(1,255)/255, math.random(1,255)/255, math.random(1,255)/255))
  49. prt.CFrame=char["Right Arm"].CFrame*CFrame.new(0,-5,0)
  50. end)
  51. end
  52. if string.lower(key)=="f" then
  53. if tograb~=nil then
  54. local GO=tograb
  55. tograb=nil
  56. GO.Anchored=false
  57. wait()
  58. GO.Velocity=(mouse.Hit.p-char["Right Arm"].Position).unit*375
  59. end
  60. end
  61. if string.lower(key)=="e" then
  62. enlarging=true
  63. while enlarging do
  64. dist=dist-.5
  65. game:service("RunService").RenderStepped:wait()
  66. end
  67. end
  68. if string.lower(key)=="q" then
  69. enshorting=true
  70. while enshorting do
  71. dist=dist+.5
  72. game:service("RunService").RenderStepped:wait()
  73. end
  74. end
  75. end)
  76. mouse.KeyUp:connect(function(key)
  77. if string.lower(key)=="e" then
  78. enlarging=false
  79. end
  80. if string.lower(key)=="q" then
  81. enshorting=false
  82. end
  83. end)
  84. coroutine.wrap(function()
  85. while true do
  86. if tograb ~= nil then
  87. tograb.CFrame=char["Right Arm"].CFrame*CFrame.new(0,dist,0)*CFrame.Angles(math.rad(90),0,math.rad(180))
  88. end
  89. game:service("RunService").RenderStepped:wait()
  90. end
  91. end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement