Advertisement
TryHarderNoob

ehhhhhhh

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