A_GUES

Telekinesis Script V3

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