Awooslayer699

Untitled

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