Advertisement
SlappyDappyCrappy

oooo

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