Advertisement
zed_isJayTheLionJR

Untitled

Feb 4th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local isScriptNil = false
  2.  
  3. local PlrName = "PDoktor"
  4. local Plrs = game:GetService("Players")
  5. local RunService = game:GetService("RunService")
  6. local Content = game:GetService("ContentProvider")
  7. local LP = Plrs.LocalPlayer
  8. local Char = LP.Character
  9. local PlrGui = LP.PlayerGui
  10. local Backpack = LP.Backpack
  11. local Mouse = LP:GetMouse()
  12.  
  13. local Camera = Workspace.CurrentCamera
  14. local LastCamCF = Camera.CoordinateFrame
  15. local AnimJoints = {}
  16. local Cons = {}
  17. local mDown = false
  18. local Multi = false
  19. local Grabbing = false
  20. local Current = {}
  21. local Alpha = 1
  22. local LightNum = 1
  23.  
  24. Current.Part = nil
  25. Current.BP = nil
  26. Current.BA = nil
  27. Current.Mass = nil
  28.  
  29. local LastPart = nil
  30.  
  31. local Head = Char["Head"]
  32. local Torso = Char["Torso"]
  33. local Humanoid = Char["Humanoid"]
  34. local LA = Char["Left Arm"]
  35. local RA = Char["Right Arm"]
  36. local LL = Char["Left Leg"]
  37. local RL = Char["Right Leg"]
  38.  
  39. local LS, RS;
  40.  
  41. local OrigLS = Torso["Left Shoulder"]
  42. local OrigRS = Torso["Right Shoulder"]
  43.  
  44. for _,v in pairs(Char:GetChildren()) do
  45. if v.Name == ModID then
  46. v:Destroy()
  47. end
  48. end
  49.  
  50. for _,v in pairs(PlrGui:GetChildren()) do
  51. if v.Name == "PadsGui" then
  52. v:Destroy()
  53. end
  54. end
  55.  
  56. local ModID = "Pads"
  57. local Objects = {}
  58. local Grav = 196.2
  59.  
  60. local sin=math.sin
  61. local cos=math.cos
  62. local max=math.max
  63. local min=math.min
  64. local atan2=math.atan2
  65. local random=math.random
  66. local tau = 2 * math.pi
  67.  
  68. local BodyObjects = {
  69. ["BodyVelocity"] = true;
  70. ["BodyAngularVelocity"] = true;
  71. ["BodyForce"] = true;
  72. ["BodyThrust"] = true;
  73. ["BodyPosition"] = true;
  74. ["RocketPropulsion"] = true;
  75. }
  76.  
  77. if LP.Name == PlrName and isScriptNil then
  78. script.Parent = nil
  79. end
  80.  
  81. LP.CameraMode = "Classic"
  82.  
  83. local Assets = {
  84. }
  85.  
  86. local LS0, LS1 = OrigLS.C0, OrigLS.C1
  87. local RS0, RS1 = OrigRS.C0, OrigRS.C1
  88.  
  89. for i,v in pairs(Assets) do
  90. local ID = tostring(Assets[i])
  91. Assets[i] =
  92. Content:Preloa
  93. end
  94.  
  95. function QuaternionFromCFrame(cf)
  96. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components();
  97. local trace = m00 + m11 + m22 if trace > 0 then
  98. local s = math.sqrt(1 + trace);
  99. local recip = 0.5/s;
  100. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5;
  101. else
  102. local i = 0;
  103. if m11 > m00 then
  104. i = 1;
  105. end;
  106. if m22 > (i == 0 and m00 or m11) then
  107. i = 2 end if i == 0 then
  108. local s = math.sqrt(m00-m11-m22+1);
  109. local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip;
  110. elseif i == 1 then
  111. local s = math.sqrt(m11-m22-m00+1);
  112. local recip = 0.5/s;
  113. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip ;
  114. elseif i == 2 then
  115. local s = math.sqrt(m22-m00-m11+1);
  116. local recip = 0.5/s;
  117. return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip;
  118. end;
  119. end;
  120. end;
  121.  
  122. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  123. local xs, ys, zs = x + x, y + y, z + z;
  124. local wx, wy, wz = w*xs, w*ys, w*zs;
  125. local xx = x*xs;
  126. local xy = x*ys;
  127. local xz = x*zs;
  128. local yy = y*ys;
  129. local yz = y*zs;
  130. local zz = z*zs;
  131. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  132. end;
  133.  
  134. function QuaternionSlerp(a, b, t)
  135. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4];
  136. local startInterp, finishInterp;
  137. if cosTheta >= 0.0001 then
  138. if (1 - cosTheta) > 0.0001 then
  139. local theta = math.acos(cosTheta);
  140. local invSinTheta = 1/math.sin(theta);
  141. startInterp = math.sin((1-t)*theta)*invSinTheta;
  142. finishInterp = math.sin(t*theta)*invSinTheta;
  143. else
  144. startInterp = 1-t finishInterp = t;
  145. end;
  146. else
  147. if (1+cosTheta) > 0.0001 then
  148. local theta = math.acos(-cosTheta);
  149. local invSinTheta = 1/math.sin(theta);
  150. startInterp = math.sin((t-1)*theta)*invSinTheta;
  151. finishInterp = math.sin(t*theta)*invSinTheta;
  152. else startInterp = t-1 finishInterp = t;
  153. end;
  154. end;
  155. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp;
  156. end;
  157.  
  158. function CLerp(a,b,t)
  159. local qa={QuaternionFromCFrame(a)};
  160. local qb={QuaternionFromCFrame(b)};
  161. local ax,ay,az=a.x,a.y,a.z;
  162. local bx,by,bz=b.x,b.y,b.z;
  163. local _t=1-t;
  164. return QuaternionToCFrame(_t*ax+t*bx,_t*ay+t*by,_t*az+t*bz,QuaternionSlerp(qa, qb, t));
  165. end
  166.  
  167. function GetWeld(weld)
  168. local obj
  169. for i, v in pairs(AnimJoints) do
  170. if v[1] == weld then
  171. obj = v
  172. break
  173. end
  174. end
  175. if not obj then
  176. obj = {weld,NV}
  177. table.insert(AnimJoints,obj)
  178. end
  179. return weld.C0.p, obj[2]
  180. end
  181.  
  182. function SetWeld(weld, i, loops, origpos, origangle, nextpos, nextangle, override, overrideLower, smooth)
  183. smooth = smooth or 1
  184. local obj
  185. for i, v in pairs(AnimJoints) do
  186. if v[1] == weld then
  187. obj = v
  188. break
  189. end
  190. end
  191. if not obj then
  192. obj = {weld,NV}
  193. table.insert(AnimJoints,obj)
  194. end
  195.  
  196. local perc = (smooth == 1 and math.sin((math.pi/2)/loops*i)) or i/loops
  197.  
  198. local tox,toy,toz = 0,0,0
  199. tox = math.abs(origangle.x - nextangle.x) *perc
  200. toy = math.abs(origangle.y - nextangle.y) *perc
  201. toz = math.abs(origangle.z - nextangle.z) *perc
  202. tox = ((origangle.x > nextangle.x and -tox) or tox)
  203. toy = ((origangle.y > nextangle.y and -toy) or toy)
  204. toz = ((origangle.z > nextangle.z and -toz) or toz)
  205.  
  206. local tox2,toy2,toz2 = 0,0,0
  207. tox2 = math.abs(origpos.x - nextpos.x) *perc
  208. toy2 = math.abs(origpos.y - nextpos.y) *perc
  209. toz2 = math.abs(origpos.z - nextpos.z) *perc
  210. tox2 = (origpos.x > nextpos.x and -tox2) or tox2
  211. toy2 = (origpos.y > nextpos.y and -toy2) or toy2
  212. toz2 = (origpos.z > nextpos.z and -toz2) or toz2
  213.  
  214. obj[2] = Vector3.new(origangle.x + tox, origangle.y + toy, origangle.z + toz)
  215. weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
  216. end
  217.  
  218. function RotateCamera(x, y)
  219. Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(x, y, 0) * CFrame.new(0, 0, (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude)
  220. end
  221.  
  222. function GetAngles(cf)
  223. local lv = cf.lookVector
  224. return -math.asin(lv.y), math.atan2(lv.x, -lv.z)
  225. end
  226.  
  227. local LastCamCF = Camera.CoordinateFrame
  228.  
  229. function Look()
  230. if AlphaOn == true then
  231. local x, y = GetAngles(LastCamCF:toObjectSpace(Camera.CoordinateFrame))
  232. Camera.CoordinateFrame = LastCamCF
  233. RotateCamera(x * -(Alpha), y * -(Alpha))
  234. LastCamCF = Camera.CoordinateFrame
  235. end
  236. end
  237.  
  238. function Cor(Func)
  239. local Ok, Err = coroutine.resume(coroutine.create(Func))
  240. if not Ok then
  241. print(Err)
  242. end
  243. end
  244.  
  245. function Cor2(Func)
  246. local Ok, Err = ypcall(Func)
  247. if not Ok then
  248. print(Err)
  249. end
  250. end
  251.  
  252. function MakePads()
  253.  
  254. -- 2 - RBase
  255. P2 = Instance.new("Part")
  256. P2.CFrame = CFrame.new(Vector3.new(21.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0)
  257. P2.FormFactor = Enum.FormFactor.Custom
  258. P2.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012)
  259. P2.Anchored = true
  260. P2.BrickColor = BrickColor.new("White")
  261. P2.Friction = 0.30000001192093
  262. P2.Shape = Enum.PartType.Block
  263. P2.Name = "RBase"
  264. P2.Parent = P1
  265. P2.Transparency = 1
  266. -- 3 - Mesh
  267. P3 = Instance.new("CylinderMesh")
  268. P3.Scale = Vector3.new(1, 0.5, 1)
  269. P3.Parent = P2
  270.  
  271. -- 4 - LBase
  272. P4 = Instance.new("Part")
  273. P4.CFrame = CFrame.new(Vector3.new(18.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0)
  274. P4.FormFactor = Enum.FormFactor.Custom
  275. P4.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012)
  276. P4.Anchored = true
  277. P4.BrickColor = BrickColor.new("White")
  278. P4.Friction = 0.30000001192093
  279. P4.Shape = Enum.PartType.Block
  280. P4.Name = "LBase"
  281. P4.Parent = P1
  282. P4.Transparency = 1
  283. -- 5 - Mesh
  284. P5 = Instance.new("CylinderMesh")
  285. P5.Scale = Vector3.new(1, 0.5, 1)
  286. P5.Parent = P4
  287.  
  288. -- 7 - Mesh
  289. P7 = Instance.new("CylinderMesh")
  290. P7.Scale = Vector3.new(1, 0.5, 1)
  291. P7.Parent = P6
  292.  
  293.  
  294.  
  295. -- 9 - Mesh
  296. P9 = Instance.new("CylinderMesh")
  297. P9.Scale = Vector3.new(1, 0.5, 1)
  298. P9.Parent = P8
  299.  
  300.  
  301.  
  302. -- 11 - Mesh
  303. P11 = Instance.new("CylinderMesh")
  304. P11.Scale = Vector3.new(1, 0.5, 1)
  305. P11.Parent = P10
  306.  
  307.  
  308. -- 13 - Mesh
  309. P13 = Instance.new("CylinderMesh")
  310. P13.Scale = Vector3.new(1, 0.5, 1)
  311. P13.Parent = P12
  312.  
  313.  
  314. -- 15 - Mesh
  315. P15 = Instance.new("CylinderMesh")
  316. P15.Scale = Vector3.new(1, 0.5, 1)
  317. P15.Parent = P14
  318.  
  319. -- 17 - Mesh
  320. P17 = Instance.new("CylinderMesh")
  321. P17.Scale = Vector3.new(1, 0.5, 1)
  322. P17.Parent = P16
  323.  
  324. P1.Parent = LP.Character
  325. P1:MakeJoints()
  326. return P1
  327. end
  328.  
  329. weldModel = function(model, unanchor, rooty)
  330. local parts = {}
  331. local function recurse(object)
  332. if object:IsA("BasePart") then
  333. table.insert(parts, object)
  334. end
  335. for _,child in pairs(object:GetChildren()) do
  336. recurse(child)
  337. end
  338. end
  339. recurse(model)
  340.  
  341. local rootPart = rooty or parts[1]
  342. for _, part in pairs(parts) do
  343. local cframe = rootPart.CFrame:toObjectSpace(part.CFrame)
  344. local weld = Instance.new("Weld")
  345. weld.Part0 = rootPart
  346. weld.Part1 = part
  347. weld.C0 = cframe
  348. weld.Parent = rootPart
  349. end
  350.  
  351. if unanchor then
  352. for _, part in pairs(parts) do
  353. part.Anchored = false
  354. part.CanCollide = false
  355. end
  356. end
  357. end
  358.  
  359. weldItem = function(rootPart, Item, TheC0, unanchor, ParentItem)
  360. local cframe = TheC0 or rootPart.CFrame:toObjectSpace(Item.CFrame)
  361. local weld = Instance.new("Weld")
  362. weld.Name = "Weld"
  363. weld.Part0 = rootPart
  364. weld.Part1 = Item
  365. weld.C0 = cframe
  366. weld.Parent = ParentItem and Item or rootPart
  367.  
  368. if unanchor then
  369. Item.Anchored = false
  370. end
  371. return weld, cframe
  372. end
  373.  
  374. scaleModel = function(model, scale)
  375. local parts = {}
  376. local function recurse(object)
  377. if object:IsA("BasePart") then
  378. table.insert(parts, object)
  379. end
  380. for _,child in pairs(object:GetChildren()) do
  381. recurse(child)
  382. end
  383. end
  384. recurse(model)
  385.  
  386. local top, bottom, left, right, back, front
  387. for _, part in pairs(parts) do
  388. if top == nil or top < part.Position.y then top = part.Position.y end
  389. if bottom == nil or bottom > part.Position.y then bottom = part.Position.y end
  390. if left == nil or left > part.Position.x then left = part.Position.x end
  391. if right == nil or right < part.Position.x then right = part.Position.x end
  392. if back == nil or back > part.Position.z then back = part.Position.z end
  393. if front == nil or front < part.Position.z then front = part.Position.z end
  394. end
  395.  
  396. local middle = Vector3.new( left+right, top+bottom, back+front )/2
  397. local minSize = Vector3.new(0.2, 0.2, 0.2)
  398.  
  399. for _, part in pairs(parts) do
  400. local foo = part.CFrame.p - middle
  401. local rotation = part.CFrame - part.CFrame.p
  402. local newSize = part.Size*scale
  403. part.FormFactor = "Custom"
  404. part.Size = newSize
  405. part.CFrame = CFrame.new( middle + foo*scale ) * rotation
  406.  
  407. if newSize.x < minSize.x or newSize.y < minSize.y or newSize.z < minSize.z then
  408. local mesh
  409. for _, child in pairs(part:GetChildren()) do
  410. if child:IsA("DataModelMesh") then
  411. mesh = child
  412. break
  413. end
  414. end
  415.  
  416. if mesh == nil then
  417. mesh = Instance.new("BlockMesh", part)
  418. end
  419.  
  420. local oScale = mesh.Scale
  421. local newScale = newSize/minSize * oScale
  422. if 0.2 < newSize.x then newScale = Vector3.new(1 * oScale.x, newScale.y, newScale.z) end
  423. if 0.2 < newSize.y then newScale = Vector3.new(newScale.x, 1 * oScale.y, newScale.z) end
  424. if 0.2 < newSize.z then newScale = Vector3.new(newScale.x, newScale.y, 1 * oScale.z) end
  425.  
  426. mesh.Scale = newScale
  427. end
  428. end
  429. end
  430.  
  431. function getMass(Obj, Total)
  432. local newTotal = Total
  433. local returnTotal = 0
  434.  
  435. if Obj:IsA("BasePart") then
  436. newTotal = newTotal + Objects[Obj]
  437. elseif BodyObjects[Obj.ClassName] then
  438. Obj:Destroy()
  439. end
  440.  
  441. if Obj:GetChildren() and #Obj:GetChildren() > 0 then
  442. for _,v in pairs(Obj:GetChildren()) do
  443. returnTotal = returnTotal + getMass(v, newTotal)
  444. end
  445. else
  446. returnTotal = newTotal
  447. end
  448.  
  449. return returnTotal
  450. end
  451.  
  452. function getTargFromCurrent()
  453. local Current = Current.Part
  454. if Current:IsA("BasePart") then
  455. return Current
  456. elseif Current:findFirstChild("Torso") then
  457. return Current.Torso
  458. else
  459. for _,v in pairs(Current:GetChildren()) do
  460. if v:IsA("BasePart") then
  461. return v
  462. end
  463. end
  464. end
  465. end
  466.  
  467. function Fire(Part, Vec, Inv)
  468. pcall(function()
  469. Current.BP:Destroy()
  470. Current.BP = nil
  471. end)
  472. pcall(function()
  473. Current.BA:Destroy()
  474. Current.BA = nil
  475. end)
  476. pcall(function()
  477. if Inv then
  478. Part.Velocity = -((Vec - Torso.Position).unit * Grav * 1.1)
  479. else
  480. Part.Velocity = ((Vec - Camera.CoordinateFrame.p).unit * Grav * 1.1)
  481. end
  482. Current.Mass = nil
  483. end)
  484. Reset()
  485. end
  486.  
  487. function Reset()
  488. LS.Parent = nil
  489. RS.Parent = nil
  490.  
  491. OrigLS.Parent = Torso
  492. OrigRS.Parent = Torso
  493.  
  494. OrigLS.C0 = LS0
  495. OrigRS.C0 = RS0
  496. end
  497.  
  498. function Start()
  499. Cor(function()
  500. repeat wait(1/30) until LP.Character and LP.Character.Parent == Workspace and LP.Character:findFirstChild("Torso")
  501. Char = LP.Character
  502. PlrGui = LP.PlayerGui
  503. Backpack = LP.Backpack
  504. Mouse = LP:GetMouse()
  505.  
  506. for _,v in pairs(Cons) do
  507. v:disconnect()
  508. end
  509. Cons = {}
  510.  
  511. Camera = Workspace.CurrentCamera
  512. LastCamCF = Camera.CoordinateFrame
  513. AnimJoints = {}
  514. mDown = false
  515. Multi = false
  516. Grabbing = false
  517. Current = {}
  518. Alpha = 1
  519.  
  520. Head = Char["Head"]
  521. Torso = Char["Torso"]
  522. Humanoid = Char["Humanoid"]
  523. LA = Char["Left Arm"]
  524. RA = Char["Right Arm"]
  525. LL = Char["Left Leg"]
  526. RL = Char["Right Leg"]
  527.  
  528. OrigLS = Torso["Left Shoulder"]
  529. OrigRS = Torso["Right Shoulder"]
  530.  
  531. for _,v in pairs(Char:GetChildren()) do
  532. if v.Name == ModID then
  533. v:Destroy()
  534. end
  535. end
  536.  
  537. for _,v in pairs(PlrGui:GetChildren()) do
  538. if v.Name == "PadsGui" then
  539. v:Destroy()
  540. end
  541. end
  542.  
  543. LS = Instance.new("Weld")
  544. RS = Instance.new("Weld")
  545.  
  546. LS.Name = OrigLS.Name
  547. LS.Part0 = Torso
  548. LS.Part1 = LA
  549. LS.C0 = LS0
  550. LS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  551.  
  552. RS.Name = OrigRS.Name
  553. RS.Part0 = Torso
  554. RS.Part1 = RA
  555. RS.C0 = RS0
  556. RS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  557.  
  558. local Pads = MakePads()
  559. local LPad = Pads.LBase
  560. local RPad = Pads.RBase
  561.  
  562. weldModel(LPad, true, LPad)
  563. weldModel(RPad, true, RPad)
  564.  
  565. local GripWeldL = Instance.new("Weld")
  566. GripWeldL.Name = "GripWeldL"
  567. GripWeldL.Part0 = LA
  568. GripWeldL.Part1 = LPad
  569. GripWeldL.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0)
  570. GripWeldL.Parent = LA
  571.  
  572. local GripWeldR = Instance.new("Weld")
  573. GripWeldR.Name = "GripWeldR"
  574. GripWeldR.Part0 = RA
  575. GripWeldR.Part1 = RPad
  576. GripWeldR.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0)
  577. GripWeldR.Parent = RA
  578.  
  579. local isParts = false
  580.  
  581. table.insert(Cons, Mouse.KeyDown:connect(function(Key)
  582. Key = Key:lower()
  583. if Key == "z" then
  584. --Stuff
  585. elseif Key == "f" then
  586. local Current = Current.Part
  587. if Current and Current.Parent ~= nil and not Multi then
  588. Current:BreakJoints()
  589. end
  590. elseif Key == "q" then
  591. if isParts then
  592. isParts = false
  593. for _,v in pairs(Workspace:GetChildren()) do
  594. if v.Name == "MyPartV" and v:IsA("BasePart") then
  595. v:Destroy()
  596. end
  597. end
  598. else
  599. isParts = true
  600. for i = 1, 50 do
  601. local Part = Instance.new("Part")
  602. Part.Color = Color3.new(math.random(), math.random(), math.random())
  603. Part.Transparency = 0
  604. Part.Size = Vector3.new(math.random(1, 3), math.random(1, 3), math.random(1, 3))
  605. Part.Archivable = true
  606. Part.CanCollide = false
  607. Part.Material = "Neon"
  608. Part.Locked = false
  609. Part.CFrame = Torso.CFrame * CFrame.new(math.random(-15, 15), -1, math.random(-15, 15))
  610. Part.Anchored = true
  611. Part.Name = "MyPartV"
  612. Part.TopSurface = "Smooth"
  613. Part.BottomSurface = "Smooth"
  614. Part.Parent = Workspace
  615. end
  616. end
  617. elseif Key == "e" then
  618. local Targ;
  619. if Current.Part and Current.Part ~= nil then
  620. Targ = getTargFromCurrent()
  621. else
  622. Targ = LastPart
  623. end
  624. if Targ and Targ.Parent ~= nil and not Multi then
  625. local Ex = Instance.new("Explosion", Workspace)
  626. Ex.Position = Targ.CFrame.p
  627. Ex.BlastRadius = 16
  628. Ex.DestroyJointRadiusPercent = 0.5
  629. end
  630. elseif Key == "c" then
  631. if Current.Part and Current.Part.Parent ~= nil and not Multi then
  632. local Part = getTargFromCurrent()
  633. if Part then
  634. Grabbing = false
  635. if Mouse.Hit then
  636. local TargPos = CFrame.new(Camera.CoordinateFrame.p, Mouse.Hit.p) * CFrame.new(0, 0, -1000)
  637. Fire(Part, TargPos.p)
  638. else
  639. Fire(Part, Mouse.Origin.p + Mouse.UnitRay.Direction, true)
  640. end
  641. end
  642. end
  643. end
  644. end))
  645.  
  646. table.insert(Cons, Mouse.Button1Up:connect(function()
  647. mDown = false
  648. if Grabbing == true and Multi == false then
  649. Grabbing = false
  650. Reset()
  651. end
  652. if Current.Part ~= nil then
  653. LastPart = getTargFromCurrent()
  654. Current = {}
  655. end
  656. end))
  657.  
  658. local function makeLightning(Par, Start, End, Width, Length, RandomScale, ArcScale, Num1)
  659. local oldParts = {}
  660. for _,v in pairs(Par:GetChildren()) do
  661. v.CFrame = CFrame.new(5e5, 5e5, 5e5)
  662. table.insert(oldParts, v)
  663. end
  664. local Distance = (Start-End).Magnitude
  665. local ArcScale = ArcScale or 1
  666. local RandomScale = RandomScale or 0
  667. local Last = Start
  668. local IterNum = 0
  669.  
  670. while Par.Parent do
  671. IterNum = IterNum + 1
  672. local New = nil
  673. if (Last-End).Magnitude < Length then
  674. New = CFrame.new(End)
  675. else
  676. if (End-Last).Magnitude < Length*2 then
  677. RandomScale = RandomScale*0.5
  678. ArcScale = ArcScale*0.5
  679. end
  680. local Direct = CFrame.new(Last,End)
  681. New = Direct*CFrame.Angles(math.rad(math.random(-RandomScale/4,RandomScale*ArcScale)),math.rad(math.random(-RandomScale,RandomScale)),math.rad(math.random(-RandomScale,RandomScale)))
  682. New = New*CFrame.new(0,0,-Length)
  683. end
  684. local Trail = nil
  685. if oldParts[IterNum] then
  686. Trail = oldParts[IterNum]
  687. Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("Cyan")
  688. Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width)
  689. Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0)
  690. oldParts[IterNum] = nil
  691. else
  692. Trail = Instance.new("Part")
  693. Trail.Name = "Part"
  694. Trail.FormFactor = "Custom"
  695. Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("White")
  696. Trail.Transparency = 0
  697. Trail.Anchored = true
  698. Trail.CanCollide = false
  699. Trail.Locked = true
  700. Trail.BackSurface = "SmoothNoOutlines"
  701. Trail.BottomSurface = "SmoothNoOutlines"
  702. Trail.FrontSurface = "SmoothNoOutlines"
  703. Trail.LeftSurface = "SmoothNoOutlines"
  704. Trail.RightSurface = "SmoothNoOutlines"
  705. Trail.TopSurface = "SmoothNoOutlines"
  706. Trail.Material = "Neon"
  707. Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width)
  708. Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0)
  709. Trail.Parent = Par
  710. end
  711. Last = New.p
  712. if (Last-End).Magnitude < 1 then
  713. break
  714. end
  715. end
  716. for _,v in pairs(oldParts) do
  717. v:Destroy()
  718. end
  719. end
  720.  
  721. table.insert(Cons, Mouse.Button1Down:connect(function()
  722. mDown = true
  723. local Targ = Mouse.Target
  724. Cor(function()
  725. if Targ and Objects[Targ] and not Multi then
  726. Grabbing = true
  727. Current.Part = Targ
  728. local Mass = Objects[Targ]
  729. local ForceNum = 0
  730. local Hum = nil
  731.  
  732. for _,v in pairs(Targ:GetChildren()) do
  733. if BodyObjects[v.ClassName] then
  734. v:Destroy()
  735. end
  736. end
  737.  
  738. for _,v in pairs(Workspace:GetChildren()) do
  739. if v:findFirstChild("Humanoid") and v:IsAncestorOf(Targ) then
  740. Hum = v.Humanoid
  741. Mass = getMass(v, 0)
  742. Current.Part = v
  743. break
  744. end
  745. end
  746.  
  747. Current.Mass = Mass
  748.  
  749. if not Hum then
  750. Targ:BreakJoints()
  751. end
  752.  
  753. ForceNum = Mass * Grav
  754. Targ.CanCollide = true
  755. Targ.Anchored = false
  756.  
  757. local BP = Instance.new("BodyPosition")
  758. BP.maxForce = Vector3.new(3 * ForceNum, 3 * ForceNum, 3 * ForceNum)
  759. BP.Parent = Targ
  760.  
  761. local Ang = Instance.new("BodyAngularVelocity")
  762. Ang.Parent = Targ
  763.  
  764. Current.BP = BP
  765. Current.BA = Ang
  766.  
  767. OrigLS.Parent = nil
  768. OrigRS.Parent = nil
  769.  
  770. LS.Parent = Torso
  771. RS.Parent = Torso
  772.  
  773. LS.C0 = LS0
  774. RS.C0 = RS0
  775.  
  776. local DirDot = Mouse.UnitRay.Direction:Dot(Targ.Position - Mouse.Origin.p)
  777. local BPPos = Vector3.new(0, 0, 0)
  778. local Vel = Vector3.new(0, 0, 0)
  779. local Vlev = random() * math.pi
  780. local RPos = Vector3.new(random() * 2 - 1, cos(Vlev), random() * 2 - 1)
  781.  
  782. local Ball = Instance.new("Part")
  783. Ball.Name = "Ball"
  784. Ball.FormFactor = "Custom"
  785. Ball.Color = Color3.new(0, 1, 1)
  786. Ball.Transparency = 0.3
  787. Ball.Anchored = true
  788. Ball.CanCollide = false
  789. Ball.Locked = true
  790. Ball.BottomSurface, Ball.TopSurface = "Smooth", "Smooth"
  791. Ball.Size = Vector3.new(0.5, 0.5, 0.5)
  792. Ball.CFrame = Torso.CFrame * CFrame.new(0, 1, -3)
  793. Ball.Parent = Char
  794.  
  795. if Targ.Name == "MyPartV" then
  796. Targ.Name = "MyPartF"
  797. end
  798.  
  799. local LightMod = Instance.new("Model", Char)
  800.  
  801. local Mesh = Instance.new("SpecialMesh")
  802. Mesh.MeshType = "Sphere"
  803. Mesh.Parent = Ball
  804.  
  805. local Size = 0.5
  806. local Rise = true
  807.  
  808. while Grabbing and BP and Ang and Targ.Parent ~= nil do
  809. local BPPos = Mouse.Origin.p + Mouse.UnitRay.Direction * DirDot
  810. Ang.angularvelocity = Vel
  811. BP.position = BPPos + RPos
  812. RPos = Vector3.new(max(-1, min(RPos.x + random() * 0.02 - 0.01, 1)), cos(Vlev), max(-1, min(RPos.z + random() * 0.02 - 0.01, 1)))
  813. Vel = Vector3.new(max(-1, min(Vel.x + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.y + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.z + random() * 0.2 - 0.1, 1)))
  814. Vlev = (Vlev + 0.05) % tau
  815.  
  816. if Hum then
  817. Hum.Sit = true
  818. end
  819.  
  820. if LA.Parent ~= nil and RA.Parent ~= nil then
  821. local LPos = (LA.CFrame * CFrame.new(0, -1, 0)).p
  822. local RPos = (RA.CFrame * CFrame.new(0, -1, 0)).p
  823. if Rise == true then
  824. if Size < 0.6 then
  825. Size = Size + 0.05
  826. else
  827. Size = Size + 0.1
  828. end
  829. if Size >= 2.2 then
  830. Rise = false
  831. end
  832. else
  833. if Size > 2.1 then
  834. Size = Size - 0.05
  835. else
  836. Size = Size - 0.1
  837. end
  838. if Size <= 0.5 then
  839. Rise = true
  840. end
  841. end
  842. Ball.Size = Vector3.new(Size, Size, Size)
  843. Ball.CFrame = CFrame.new(LPos:Lerp(RPos, 0.5), Targ.Position) * CFrame.new(0, 0, -2.2)
  844. LightNum = LightNum + 1
  845. makeLightning(LightMod, Ball.Position, Targ.Position, 0.2, 4, 50, 1, LightNum)
  846. elseif Ball.Parent ~= nil then
  847. Ball:Destroy()
  848. end
  849.  
  850. if LS and LS.Parent == Torso then
  851. LS.C0 = CFrame.new(Vector3.new(-1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(-1.5, 0.5, 1)).p))
  852. end
  853. if RS and RS.Parent == Torso then
  854. RS.C0 = CFrame.new(Vector3.new(1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(1.5, 0.5, 1)).p))
  855. end
  856. RunService.Heartbeat:wait()
  857. end
  858.  
  859. coroutine.resume(coroutine.create(function()
  860. for i = 0.5, 1, 0.1 do
  861. for i2,v in pairs(LightMod:GetChildren()) do
  862. --v.Light.Range = 6-(i*5)
  863. v.Transparency = i
  864. end
  865. wait(1/30)
  866. end
  867. LightMod:Destroy()
  868. end))
  869.  
  870. if BP and BP.Parent ~= nil then
  871. BP:Destroy()
  872. end
  873.  
  874. if Ang and Ang.Parent ~= nil then
  875. Ang:Destroy()
  876. end
  877.  
  878. pcall(function() Ball:Destroy() end)
  879. end
  880. end)
  881. end))
  882. end)
  883. end
  884.  
  885. function Add(Obj)
  886. if Obj:IsA("BasePart") and not Objects[Obj] and not (Obj.Name == "Base" and Obj.ClassName == "Part") then
  887. Objects[Obj] = Obj:GetMass()
  888. Obj.Changed:connect(function(P)
  889. if P:lower() == "size" and Objects[Obj] and Obj.Parent ~= nil then
  890. Objects[Obj] = Obj:GetMass()
  891. end
  892. end)
  893. end
  894. end
  895.  
  896. function Rem(Obj)
  897. if Objects[Obj] then
  898. Objects[Obj] = nil
  899. end
  900. end
  901.  
  902. function Recursion(Obj)
  903. ypcall(function()
  904. Add(Obj)
  905. if #Obj:GetChildren() > 0 then
  906. for _,v in pairs(Obj:GetChildren()) do
  907. Recursion(v)
  908. end
  909. end
  910. end)
  911. end
  912.  
  913. Workspace.DescendantAdded:connect(function(Obj)
  914. Add(Obj)
  915. end)
  916.  
  917. Workspace.DescendantRemoving:connect(function(Obj)
  918. Rem(Obj)
  919. end)
  920.  
  921. for _,v in pairs(Workspace:GetChildren()) do
  922. Recursion(v)
  923. end
  924.  
  925. Start()
  926.  
  927. if LP.Name == PlrName then
  928. LP.CharacterAdded:connect(Start)
  929. end
  930.  
  931. local verlet = {}
  932. verlet.step_time = 1 / 50
  933. verlet.gravity = Vector3.new(0, -10, 0)
  934.  
  935. local char = game.Players.LocalPlayer.Character
  936. local torso = char:WaitForChild("Torso")
  937. local parts = {}
  938. local render = game:GetService("RunService").RenderStepped
  939.  
  940. wait(2)
  941.  
  942. local point = {}
  943. local link = {}
  944. local rope = {}
  945.  
  946. local function ccw(A,B,C)
  947. return (C.y-A.y) * (B.x-A.x) > (B.y-A.y) * (C.x-A.x)
  948. end
  949.  
  950. local function intersect(A,B,C,D)
  951. return ccw(A,C,D) ~= ccw(B,C,D) and ccw(A,B,C) ~= ccw(A,B,D)
  952. end
  953.  
  954. local function vec2(v)
  955. return Vector2.new(v.x, v.z)
  956. end
  957.  
  958. function point:step()
  959. if not self.fixed then
  960. local derivative = (self.position - self.last_position) * 0.95
  961. self.last_position = self.position
  962. self.position = self.position + derivative + (self.velocity * verlet.step_time ^ 2)
  963. --[[local torsoP = torso.CFrame * CFrame.new(-1, 0, 0.5)
  964. local torsoE = torso.CFrame * CFrame.new(1, 0, 0.5)
  965. local pointE = self.position + torso.CFrame.lookVector * 100
  966. local doIntersect = intersect(vec2(torsoP.p), vec2(torsoE.p), vec2(self.position), vec2(pointE))
  967. if not doIntersect then
  968. self.postition = self.position - torso.CFrame.lookVector * 10
  969. end]]
  970. end
  971. end
  972.  
  973. function link:step()
  974. for i = 1, 1 do
  975. local distance = self.point1.position - self.point2.position
  976. local magnitude = distance.magnitude
  977. local differance = (self.length - magnitude) / magnitude
  978. local translation = ((self.point1.fixed or self.point2.fixed) and 1 or 0.6) * distance * differance
  979. if not self.point1.fixed then
  980. self.point1.position = self.point1.position + translation
  981. end
  982. if not self.point2.fixed then
  983. self.point2.position = self.point2.position - translation
  984. end
  985. end
  986. end
  987.  
  988. function verlet.new(class, a, b, c)
  989. if class == "Point" then
  990. local new = {}
  991. setmetatable(new, {__index = point})
  992. new.class = class
  993. new.position = a or Vector3.new()
  994. new.last_position = new.position
  995. new.velocity = verlet.gravity
  996. new.fixed = false
  997. return new
  998. elseif class == "Link" then
  999. local new = {}
  1000. setmetatable(new, {__index = link})
  1001. new.class = class
  1002. new.point1 = a
  1003. new.point2 = b
  1004. new.length = c or (a.position - b.position).magnitude
  1005. return new
  1006. elseif class == "Rope" then
  1007. local new = {}
  1008. setmetatable(new, {__index = link})
  1009. new.class = class
  1010. new.start_point = a
  1011. new.finish_point = b
  1012. new.points = {}
  1013. new.links = {}
  1014. local inc = (b - a) / 10
  1015. for i = 0, 10 do
  1016. table.insert(new.points, verlet.new("Point", a + (i * inc)))
  1017. end
  1018. for i = 2, #new.points do
  1019. table.insert(new.links, verlet.new("Link", new.points[i - 1], new.points[i]))
  1020. end
  1021. return new
  1022. end
  1023. end
  1024.  
  1025. local tris = {}
  1026. local triParts = {}
  1027.  
  1028. local function GetDiscoColor(hue)
  1029. local section = hue % 1 * 3
  1030. local secondary = 0.5 * math.pi * (section % 1)
  1031. if section < 1 then
  1032. return Color3.new(0, 0, 0)
  1033. elseif section < 2 then
  1034. return Color3.new(0, 0, 0)
  1035. else
  1036. return Color3.new(0, 0, 0)
  1037. end
  1038. end
  1039.  
  1040. local function setupPart(part)
  1041. part.Anchored = true
  1042. part.FormFactor = 3
  1043. part.CanCollide = false
  1044. part.TopSurface = 10
  1045. part.BottomSurface = 10
  1046. part.LeftSurface = 10
  1047. part.RightSurface = 10
  1048. part.FrontSurface = 10
  1049. part.BackSurface = 10
  1050. part.Material = "Neon"
  1051. local m = Instance.new("SpecialMesh", part)
  1052. m.MeshType = "Wedge"
  1053. m.Scale = Vector3.new(0.2, 1, 1)
  1054. return part
  1055. end
  1056.  
  1057. local function CFrameFromTopBack(at, top, back)
  1058. local right = top:Cross(back)
  1059. return CFrame.new(at.x, at.y, at.z, right.x, top.x, back.x, right.y, top.y, back.y, right.z, top.z, back.z)
  1060. end
  1061.  
  1062. local function drawTri(parent, a, b, c)
  1063. local this = {}
  1064. local mPart1 = table.remove(triParts, 1) or setupPart(Instance.new("Part"))
  1065. local mPart2 = table.remove(triParts, 1) or setupPart(Instance.new("Part"))
  1066. function this:Set(a, b, c)
  1067. local ab, bc, ca = b-a, c-b, a-c
  1068. local abm, bcm, cam = ab.magnitude, bc.magnitude, ca.magnitude
  1069. local edg1 = math.abs(0.5 + ca:Dot(ab)/(abm*abm))
  1070. local edg2 = math.abs(0.5 + ab:Dot(bc)/(bcm*bcm))
  1071. local edg3 = math.abs(0.5 + bc:Dot(ca)/(cam*cam))
  1072. if edg1 < edg2 then
  1073. if edg1 >= edg3 then
  1074. a, b, c = c, a, b
  1075. ab, bc, ca = ca, ab, bc
  1076. abm = cam
  1077. end
  1078. else
  1079. if edg2 < edg3 then
  1080. a, b, c = b, c, a
  1081. ab, bc, ca = bc, ca, ab
  1082. abm = bcm
  1083. else
  1084. a, b, c = c, a, b
  1085. ab, bc, ca = ca, ab, bc
  1086. abm = cam
  1087. end
  1088. end
  1089.  
  1090. local len1 = -ca:Dot(ab)/abm
  1091. local len2 = abm - len1
  1092. local width = (ca + ab.unit*len1).magnitude
  1093.  
  1094. local maincf = CFrameFromTopBack(a, ab:Cross(bc).unit, -ab.unit)
  1095.  
  1096. if len1 > 0.2 then
  1097. mPart1.Parent = parent
  1098. mPart1.Size = Vector3.new(0.2, width, len1)
  1099. mPart1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
  1100. else
  1101. mPart1.Parent = nil
  1102. end
  1103.  
  1104. if len2 > 0.2 then
  1105. mPart2.Parent = parent
  1106. mPart2.Size = Vector3.new(0.2, width, len2)
  1107. mPart2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
  1108. else
  1109. mPart2.Parent = nil
  1110. end
  1111. end
  1112. function this:SetProperty(prop, value)
  1113. mPart1[prop] = value
  1114. mPart2[prop] = value
  1115. end
  1116. this:Set(a, b, c)
  1117. function this:Destroy()
  1118. mPart1:Destroy()
  1119. mPart2:Destroy()
  1120. end
  1121. this.p1 = mPart1
  1122. this.p2 = mPart2
  1123. this.p1.BrickColor = BrickColor.new(GetDiscoColor(math.noise(0.5, 0.5, this.p1.CFrame.Y * 0.5 + time())))
  1124. this.p2.BrickColor = BrickColor.new(GetDiscoColor(math.noise(0.5, 0.5, this.p2.CFrame.Y * 0.5 + time())))
  1125. return this
  1126. end
  1127.  
  1128. function verlet.draw(object, id)
  1129. if object.class == "Point" then
  1130. local part = parts[id]
  1131. part.BrickColor = BrickColor.new(107, 0, 107)
  1132. part.Transparency = 0
  1133. part.formFactor = 3
  1134. part.Anchored = true
  1135. part.CanCollide = false
  1136. part.TopSurface = 0
  1137. part.BottomSurface = 0
  1138. part.Size = Vector3.new(0.35, 0.35, 0.35)
  1139. part.Material = "Neon"
  1140. part.CFrame = CFrame.new(object.position)
  1141. part.Parent = torso
  1142. return part
  1143. elseif object.class == "Link" then
  1144. local part = parts[id]
  1145. local dist = (object.point1.position - object.point2.position).magnitude
  1146. part.Size = Vector3.new(0.2, 0.2, dist)
  1147. part.CFrame = CFrame.new(object.point1.position, object.point2.position) * CFrame.new(0, 0, dist * -0.5)
  1148. part.Parent = torso
  1149. return part
  1150. end
  1151. end
  1152.  
  1153. function verlet.clear()
  1154. for _, v in pairs(workspace:GetChildren()) do
  1155. if v.Name == "Part" then
  1156. v:Destroy()
  1157. end
  1158. end
  1159. end
  1160.  
  1161. local points = {}
  1162. local links = {}
  1163.  
  1164. for x = 0, 2 do
  1165. points[x] = {}
  1166. for y = 0, 3 do
  1167. points[x][y] = verlet.new("Point", torso.Position + Vector3.new(x * 0.8 - 2, 2 - y * 0.8, 5 + y * 0.4))
  1168. points[x][y].fixed = y == 0
  1169. end
  1170. end
  1171.  
  1172. for x = 1, 2 do
  1173. for y = 0, 3 do
  1174. links[#links + 1] = verlet.new("Link", points[x][y], points[x - 1][y], 1 + y * 0.08)
  1175. end
  1176. end
  1177.  
  1178. for x = 0, 2 do
  1179. for y = 1, 3 do
  1180. links[#links + 1] = verlet.new("Link", points[x][y], points[x][y - 1], 1.2 + y * 0.03)
  1181. end
  1182. end
  1183.  
  1184. render:connect(function()
  1185. for x = 0, 2 do
  1186. for y = 0, 3 do
  1187. if y == 0 then
  1188. points[x][y].position = (torso.CFrame * CFrame.new(x * 1 - 1, 1, 0.5)).p
  1189. else
  1190. points[x][y]:step()
  1191. end
  1192. end
  1193. end
  1194. for i = 1, #links do
  1195. links[i]:step()
  1196. end
  1197. for i = 1, #tris do
  1198. triParts[#triParts + 1] = tris[i].p1
  1199. triParts[#triParts + 1] = tris[i].p2
  1200. end
  1201. tris = {}
  1202. for x = 1, 2 do
  1203. for y = 1, 3 do
  1204. tris[#tris + 1] = drawTri(torso, points[x - 1][y - 1].position, points[x - 1][y].position, points[x][y - 1].position)
  1205. tris[#tris + 1] = drawTri(torso, points[x][y].position, points[x - 1][y].position, points[x][y - 1].position)
  1206. end
  1207. end
  1208. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement