Hugo1234cool

Untitled

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