DoingYourDad22

Roblox FE Telekinesis script

Oct 15th, 2021 (edited)
110,256
2
Never
4
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.91 KB | None | 2 0
  1. local function a(b, c)
  2. local d = getfenv(c)
  3. local e =
  4. setmetatable(
  5. {},
  6. {__index = function(self, f)
  7. if f == "script" then
  8. return b
  9. else
  10. return d[f]
  11. end
  12. end}
  13. )
  14. setfenv(c, e)
  15. return c
  16. end
  17. local g = {}
  18. local h = Instance.new("Model", game:GetService("Lighting"))
  19. local i = Instance.new("Tool")
  20. local j = Instance.new("Part")
  21. local k = Instance.new("Script")
  22. local l = Instance.new("LocalScript")
  23. local m = sethiddenproperty or set_hidden_property
  24. i.Name = "Telekinesis"
  25. i.Parent = h
  26. i.Grip = CFrame.new(0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
  27. i.GripForward = Vector3.new(-0, -1, -0)
  28. i.GripRight = Vector3.new(0, 0, 1)
  29. i.GripUp = Vector3.new(1, 0, 0)
  30. j.Name = "Handle"
  31. j.Parent = i
  32. j.CFrame = CFrame.new(-17.2635937, 15.4915619, 46, 0, 1, 0, 1, 0, 0, 0, 0, -1)
  33. j.Orientation = Vector3.new(0, 180, 90)
  34. j.Position = Vector3.new(-17.2635937, 15.4915619, 46)
  35. j.Rotation = Vector3.new(-180, 0, -90)
  36. j.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  37. j.Transparency = 1
  38. j.Size = Vector3.new(1, 1.20000005, 1)
  39. j.BottomSurface = Enum.SurfaceType.Weld
  40. j.BrickColor = BrickColor.new("Really black")
  41. j.Material = Enum.Material.Metal
  42. j.TopSurface = Enum.SurfaceType.Smooth
  43. j.brickColor = BrickColor.new("Really black")
  44. k.Name = "LineConnect"
  45. k.Parent = i
  46. table.insert(
  47. g,
  48. a(
  49. k,
  50. function()
  51. wait()
  52. local n = script.Part2
  53. local o = script.Part1.Value
  54. local p = script.Part2.Value
  55. local q = script.Par.Value
  56. local color = script.Color
  57. local r = Instance.new("Part")
  58. r.TopSurface = 0
  59. r.BottomSurface = 0
  60. r.Reflectance = .5
  61. r.Name = "Laser"
  62. r.Locked = true
  63. r.CanCollide = false
  64. r.Anchored = true
  65. r.formFactor = 0
  66. r.Size = Vector3.new(1, 1, 1)
  67. local s = Instance.new("BlockMesh")
  68. s.Parent = r
  69. while true do
  70. if n.Value == nil then
  71. break
  72. end
  73. if o == nil or p == nil or q == nil then
  74. break
  75. end
  76. if o.Parent == nil or p.Parent == nil then
  77. break
  78. end
  79. if q.Parent == nil then
  80. break
  81. end
  82. local t = CFrame.new(o.Position, p.Position)
  83. local dist = (o.Position - p.Position).magnitude
  84. r.Parent = q
  85. r.BrickColor = color.Value.BrickColor
  86. r.Reflectance = color.Value.Reflectance
  87. r.Transparency = color.Value.Transparency
  88. r.CFrame = CFrame.new(o.Position + t.lookVector * dist / 2)
  89. r.CFrame = CFrame.new(r.Position, p.Position)
  90. s.Scale = Vector3.new(.25, .25, dist)
  91. wait()
  92. end
  93. r:remove()
  94. script:remove()
  95. end
  96. )
  97. )
  98. k.Disabled = true
  99. l.Name = "MainScript"
  100. l.Parent = i
  101. table.insert(
  102. g,
  103. a(
  104. l,
  105. function()
  106. wait()
  107. tool = script.Parent
  108. lineconnect = tool.LineConnect
  109. object = nil
  110. mousedown = false
  111. found = false
  112. BP = Instance.new("BodyPosition")
  113. BP.maxForce = Vector3.new(math.huge * math.huge, math.huge * math.huge, math.huge * math.huge)
  114. BP.P = BP.P * 1.1
  115. dist = nil
  116. point = Instance.new("Part")
  117. point.Locked = true
  118. point.Anchored = true
  119. point.formFactor = 0
  120. point.Shape = 0
  121. point.BrickColor = BrickColor.Black()
  122. point.Size = Vector3.new(1, 1, 1)
  123. point.CanCollide = false
  124. local s = Instance.new("SpecialMesh")
  125. s.MeshType = "Sphere"
  126. s.Scale = Vector3.new(.7, .7, .7)
  127. s.Parent = point
  128. handle = tool.Handle
  129. front = tool.Handle
  130. color = tool.Handle
  131. objval = nil
  132. local u = false
  133. local v = BP:clone()
  134. v.maxForce = Vector3.new(30000, 30000, 30000)
  135. function LineConnect(o, p, q)
  136. local w = Instance.new("ObjectValue")
  137. w.Value = o
  138. w.Name = "Part1"
  139. local x = Instance.new("ObjectValue")
  140. x.Value = p
  141. x.Name = "Part2"
  142. local y = Instance.new("ObjectValue")
  143. y.Value = q
  144. y.Name = "Par"
  145. local z = Instance.new("ObjectValue")
  146. z.Value = color
  147. z.Name = "Color"
  148. local A = lineconnect:clone()
  149. A.Disabled = false
  150. w.Parent = A
  151. x.Parent = A
  152. y.Parent = A
  153. z.Parent = A
  154. A.Parent = workspace
  155. if p == object then
  156. objval = x
  157. end
  158. end
  159. function onButton1Down(B)
  160. if mousedown == true then
  161. return
  162. end
  163. mousedown = true
  164. coroutine.resume(
  165. coroutine.create(
  166. function()
  167. local C = point:clone()
  168. C.Parent = tool
  169. LineConnect(front, C, workspace)
  170. while mousedown == true do
  171. C.Parent = tool
  172. if object == nil then
  173. if B.Target == nil then
  174. local t = CFrame.new(front.Position, B.Hit.p)
  175. C.CFrame = CFrame.new(front.Position + t.lookVector * 1000)
  176. else
  177. C.CFrame = CFrame.new(B.Hit.p)
  178. end
  179. else
  180. LineConnect(front, object, workspace)
  181. break
  182. end
  183. wait()
  184. end
  185. C:remove()
  186. end
  187. )
  188. )
  189. while mousedown == true do
  190. if B.Target ~= nil then
  191. local D = B.Target
  192. if D.Anchored == false then
  193. object = D
  194. dist = (object.Position - front.Position).magnitude
  195. break
  196. end
  197. end
  198. wait()
  199. end
  200. while mousedown == true do
  201. if object.Parent == nil then
  202. break
  203. end
  204. local t = CFrame.new(front.Position, B.Hit.p)
  205. BP.Parent = object
  206. BP.position = front.Position + t.lookVector * dist
  207. wait()
  208. end
  209. BP:remove()
  210. object = nil
  211. objval.Value = nil
  212. end
  213. function onKeyDown(E, B)
  214. local E = E:lower()
  215. local F = false
  216. if E == "q" then
  217. if dist >= 5 then
  218. dist = dist - 10
  219. end
  220. end
  221. if E == "r" then
  222. if object == nil then
  223. return
  224. end
  225. for G, H in pairs(object:children()) do
  226. if H.className == "BodyGyro" then
  227. return nil
  228. end
  229. end
  230. BG = Instance.new("BodyGyro")
  231. BG.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  232. BG.cframe = CFrame.new(object.CFrame.p)
  233. BG.Parent = object
  234. repeat
  235. wait()
  236. until object.CFrame == CFrame.new(object.CFrame.p)
  237. BG.Parent = nil
  238. if object == nil then
  239. return
  240. end
  241. for G, H in pairs(object:children()) do
  242. if H.className == "BodyGyro" then
  243. H.Parent = nil
  244. end
  245. end
  246. object.Velocity = Vector3.new(0, 0, 0)
  247. object.RotVelocity = Vector3.new(0, 0, 0)
  248. object.Orientation = Vector3.new(0, 0, 0)
  249. end
  250. if E == "e" then
  251. dist = dist + 10
  252. end
  253. if E == "t" then
  254. if dist ~= 10 then
  255. dist = 10
  256. end
  257. end
  258. if E == "y" then
  259. if dist ~= 200 then
  260. dist = 200
  261. end
  262. end
  263. if E == "=" then
  264. BP.P = BP.P * 1.5
  265. end
  266. if E == "-" then
  267. BP.P = BP.P * 0.5
  268. end
  269. end
  270. function onEquipped(B)
  271. keymouse = B
  272. local I = tool.Parent
  273. human = I.Humanoid
  274. human.Changed:connect(
  275. function()
  276. if human.Health == 0 then
  277. mousedown = false
  278. BP:remove()
  279. point:remove()
  280. tool:remove()
  281. end
  282. end
  283. )
  284. B.Button1Down:connect(
  285. function()
  286. onButton1Down(B)
  287. end
  288. )
  289. B.Button1Up:connect(
  290. function()
  291. mousedown = false
  292. end
  293. )
  294. B.KeyDown:connect(
  295. function(E)
  296. onKeyDown(E, B)
  297. end
  298. )
  299. B.Icon = "rbxasset://textures\\GunCursor.png"
  300. end
  301. tool.Equipped:connect(onEquipped)
  302. end
  303. )
  304. )
  305. for J, H in pairs(h:GetChildren()) do
  306. H.Parent = game:GetService("Players").LocalPlayer.Backpack
  307. pcall(
  308. function()
  309. H:MakeJoints()
  310. end
  311. )
  312. end
  313. h:Destroy()
  314. for J, H in pairs(g) do
  315. spawn(
  316. function()
  317. pcall(H)
  318. end
  319. )
  320. end
Comments
Add Comment
Please, Sign In to add comment