Advertisement
DylanD2003

Untitled

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