Advertisement
SmokeDelsin

heheh

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