DylanD2003

Untitled

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