Advertisement
DylanD2003

Untitled

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