Advertisement
Void_scripter0

cape

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