Advertisement
Guest User

Untitled

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