Advertisement
Ant8893

MyWorld#4430 reanimate

Jun 6th, 2022 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.46 KB | None | 0 0
  1. --reanimate by MyWorld#4430 discord.gg/pYVHtSJmEY
  2. local Vector3_101 = Vector3.new(1, 0, 1)
  3. local netless_Y = Vector3.new(0, 25.1, 0)
  4. local function getNetlessVelocity(realPartVelocity) --change this if you have a better method
  5. local mag = realPartVelocity.Magnitude
  6. if (mag > 1) and (mag < 100) then
  7. local unit = realPartVelocity.Unit
  8. if (unit.Y > 0.25) or (unit.Y < -0.75) then
  9. return realPartVelocity * (25.1 / realPartVelocity.Y)
  10. end
  11. realPartVelocity = unit * 100
  12. end
  13. return (realPartVelocity * Vector3_101) + netless_Y
  14. end
  15. local simradius = "false" --simulation radius (net bypass) method
  16. --"shp" - sethiddenproperty
  17. --"ssr" - setsimulationradius
  18. --false - disable
  19. local noclipAllParts = false --set it to true if you want noclip
  20. local antiragdoll = true --removes hingeConstraints and ballSocketConstraints from your character
  21. local newanimate = true --disables the animate script and enables after reanimation
  22. local discharscripts = true --disables all localScripts parented to your character before reanimation
  23. local R15toR6 = true --tries to convert your character to r6 if its r15
  24. local hatcollide = false --makes hats cancollide (credit to ShownApe) (works only with reanimate method 0)
  25. local humState16 = true --enables collisions for limbs before the humanoid dies (using hum:ChangeState)
  26. local addtools = false --puts all tools from backpack to character and lets you hold them after reanimation
  27. local hedafterneck = true --disable aligns for head and enable after neck or torso is removed
  28. local loadtime = game:GetService("Players").RespawnTime + 0.5 --anti respawn delay
  29. local method = 1 --reanimation method
  30. --methods:
  31. --0 - breakJoints (takes [loadtime] seconds to laod)
  32. --1 - limbs
  33. --2 - limbs + anti respawn
  34. --3 - limbs + breakJoints after [loadtime] seconds
  35. --4 - remove humanoid + breakJoints
  36. --5 - remove humanoid + limbs
  37. local alignmode = 2 --AlignPosition mode
  38. --modes:
  39. --1 - AlignPosition rigidity enabled true
  40. --2 - 2 AlignPositions rigidity enabled both true and false
  41. --3 - AlignPosition rigidity enabled false
  42. local flingpart = "HumanoidRootPart" --name of the part or the hat used for flinging
  43. --the fling function
  44. --usage: fling(target, duration, velocity)
  45. --target can be set to: basePart, CFrame, Vector3, character model or humanoid (flings at mouse.Hit if argument not provided))
  46. --duration (fling time in seconds) can be set to: a number or a string convertable to the number (0.5s if not provided),
  47. --velocity (fling part rotation velocity) can be set to a vector3 value (Vector3.new(20000, 20000, 20000) if not provided)
  48.  
  49. local lp = game:GetService("Players").LocalPlayer
  50. local rs = game:GetService("RunService")
  51. local stepped = rs.Stepped
  52. local heartbeat = rs.Heartbeat
  53. local renderstepped = rs.RenderStepped
  54. local sg = game:GetService("StarterGui")
  55. local ws = game:GetService("Workspace")
  56. local cf = CFrame.new
  57. local v3 = Vector3.new
  58. local v3_0 = Vector3.zero
  59. local inf = math.huge
  60.  
  61. local c = lp.Character
  62.  
  63. if not (c and c.Parent) then
  64. return
  65. end
  66.  
  67. c:GetPropertyChangedSignal("Parent"):Connect(function()
  68. if not (c and c.Parent) then
  69. c = nil
  70. end
  71. end)
  72.  
  73. local function gp(parent, name, className)
  74. if typeof(parent) == "Instance" then
  75. for i, v in pairs(parent:GetChildren()) do
  76. if (v.Name == name) and v:IsA(className) then
  77. return v
  78. end
  79. end
  80. end
  81. return nil
  82. end
  83.  
  84. if type(getNetlessVelocity) ~= "function" then
  85. getNetlessVelocity = nil
  86. end
  87.  
  88. local function align(Part0, Part1)
  89. Part0.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
  90.  
  91. local att0 = Instance.new("Attachment")
  92. att0.Orientation = v3_0
  93. att0.Position = v3_0
  94. att0.Name = "att0_" .. Part0.Name
  95. local att1 = Instance.new("Attachment")
  96. att1.Orientation = v3_0
  97. att1.Position = v3_0
  98. att1.Name = "att1_" .. Part1.Name
  99.  
  100. if (alignmode == 1) or (alignmode == 2) then
  101. local ape = Instance.new("AlignPosition", att0)
  102. ape.ApplyAtCenterOfMass = false
  103. ape.MaxForce = inf
  104. ape.MaxVelocity = inf
  105. ape.ReactionForceEnabled = false
  106. ape.Responsiveness = 200
  107. ape.Attachment1 = att1
  108. ape.Attachment0 = att0
  109. ape.Name = "AlignPositionRtrue"
  110. ape.RigidityEnabled = true
  111. end
  112.  
  113. if (alignmode == 2) or (alignmode == 3) then
  114. local apd = Instance.new("AlignPosition", att0)
  115. apd.ApplyAtCenterOfMass = false
  116. apd.MaxForce = inf
  117. apd.MaxVelocity = inf
  118. apd.ReactionForceEnabled = false
  119. apd.Responsiveness = 200
  120. apd.Attachment1 = att1
  121. apd.Attachment0 = att0
  122. apd.Name = "AlignPositionRfalse"
  123. apd.RigidityEnabled = false
  124. end
  125.  
  126. local ao = Instance.new("AlignOrientation", att0)
  127. ao.MaxAngularVelocity = inf
  128. ao.MaxTorque = inf
  129. ao.PrimaryAxisOnly = false
  130. ao.ReactionTorqueEnabled = false
  131. ao.Responsiveness = 200
  132. ao.Attachment1 = att1
  133. ao.Attachment0 = att0
  134. ao.RigidityEnabled = false
  135.  
  136. if getNetlessVelocity then
  137. local vel = Part0.Velocity
  138. local velpart = Part1
  139. local rsteppedcon = renderstepped:Connect(function()
  140. Part0.Velocity = vel
  141. end)
  142. local heartbeatcon = heartbeat:Connect(function()
  143. vel = Part0.Velocity
  144. Part0.Velocity = getNetlessVelocity(velpart.Velocity)
  145. end)
  146. local attcon = nil
  147. Part0:GetPropertyChangedSignal("Parent"):Connect(function()
  148. if not (Part0 and Part0.Parent) then
  149. rsteppedcon:Disconnect()
  150. heartbeatcon:Disconnect()
  151. attcon:Disconnect()
  152. end
  153. end)
  154. attcon = att1:GetPropertyChangedSignal("Parent"):Connect(function()
  155. if not (att1 and att1.Parent) then
  156. attcon:Disconnect()
  157. velpart = Part0
  158. else
  159. velpart = att1.Parent
  160. if not velpart:IsA("BasePart") then
  161. velpart = Part0
  162. end
  163. end
  164. end)
  165. end
  166.  
  167. att0.Parent = Part0
  168. att1.Parent = Part1
  169. end
  170.  
  171. local function respawnrequest()
  172. local ccfr = ws.CurrentCamera.CFrame
  173. local c = lp.Character
  174. lp.Character = nil
  175. lp.Character = c
  176. local con = nil
  177. con = ws.CurrentCamera.Changed:Connect(function(prop)
  178. if (prop ~= "Parent") and (prop ~= "CFrame") then
  179. return
  180. end
  181. ws.CurrentCamera.CFrame = ccfr
  182. con:Disconnect()
  183. end)
  184. end
  185.  
  186. local destroyhum = (method == 4) or (method == 5)
  187. local breakjoints = (method == 0) or (method == 4)
  188. local antirespawn = (method == 0) or (method == 2) or (method == 3)
  189.  
  190. hatcollide = hatcollide and (method == 0)
  191.  
  192. addtools = addtools and gp(lp, "Backpack", "Backpack")
  193.  
  194. local fenv = getfenv()
  195. local shp = fenv.sethiddenproperty or fenv.set_hidden_property or fenv.set_hidden_prop or fenv.sethiddenprop
  196. local ssr = fenv.setsimulationradius or fenv.set_simulation_radius or fenv.set_sim_radius or fenv.setsimradius or fenv.set_simulation_rad or fenv.setsimulationrad
  197.  
  198. if shp and (simradius == "shp") then
  199. spawn(function()
  200. while c and heartbeat:Wait() do
  201. shp(lp, "SimulationRadius", inf)
  202. end
  203. end)
  204. elseif ssr and (simradius == "ssr") then
  205. spawn(function()
  206. while c and heartbeat:Wait() do
  207. ssr(inf)
  208. end
  209. end)
  210. end
  211.  
  212. antiragdoll = antiragdoll and function(v)
  213. if v:IsA("HingeConstraint") or v:IsA("BallSocketConstraint") then
  214. v.Parent = nil
  215. end
  216. end
  217.  
  218. if antiragdoll then
  219. for i, v in pairs(c:GetDescendants()) do
  220. antiragdoll(v)
  221. end
  222. c.DescendantAdded:Connect(antiragdoll)
  223. end
  224.  
  225. if antirespawn then
  226. respawnrequest()
  227. end
  228.  
  229. if method == 0 then
  230. wait(loadtime)
  231. if not c then
  232. return
  233. end
  234. end
  235.  
  236. if discharscripts then
  237. for i, v in pairs(c:GetChildren()) do
  238. if v:IsA("LocalScript") then
  239. v.Disabled = true
  240. end
  241. end
  242. elseif newanimate then
  243. local animate = gp(c, "Animate", "LocalScript")
  244. if animate and (not animate.Disabled) then
  245. animate.Disabled = true
  246. else
  247. newanimate = false
  248. end
  249. end
  250.  
  251. if addtools then
  252. for i, v in pairs(addtools:GetChildren()) do
  253. if v:IsA("Tool") then
  254. v.Parent = c
  255. end
  256. end
  257. end
  258.  
  259. pcall(function()
  260. settings().Physics.AllowSleep = false
  261. settings().Physics.PhysicsEnvironmentalThrottle = Enum.EnviromentalPhysicsThrottle.Disabled
  262. end)
  263.  
  264. local OLDscripts = {}
  265.  
  266. for i, v in pairs(c:GetDescendants()) do
  267. if v.ClassName == "Script" then
  268. table.insert(OLDscripts, v)
  269. end
  270. end
  271.  
  272. local scriptNames = {}
  273.  
  274. for i, v in pairs(c:GetDescendants()) do
  275. if v:IsA("BasePart") then
  276. local newName = tostring(i)
  277. local exists = true
  278. while exists do
  279. exists = false
  280. for i, v in pairs(OLDscripts) do
  281. if v.Name == newName then
  282. exists = true
  283. end
  284. end
  285. if exists then
  286. newName = newName .. "_"
  287. end
  288. end
  289. table.insert(scriptNames, newName)
  290. Instance.new("Script", v).Name = newName
  291. end
  292. end
  293.  
  294. c.Archivable = true
  295. local hum = c:FindFirstChildOfClass("Humanoid")
  296. if hum then
  297. for i, v in pairs(hum:GetPlayingAnimationTracks()) do
  298. v:Stop()
  299. end
  300. end
  301. local cl = c:Clone()
  302. if hum and humState16 then
  303. hum:ChangeState(Enum.HumanoidStateType.Physics)
  304. if destroyhum then
  305. wait(1.6)
  306. end
  307. end
  308. if hum and hum.Parent and destroyhum then
  309. hum:Destroy()
  310. end
  311.  
  312. if not c then
  313. return
  314. end
  315.  
  316. local head = gp(c, "Head", "BasePart")
  317. local torso = gp(c, "Torso", "BasePart") or gp(c, "UpperTorso", "BasePart")
  318. local root = gp(c, "HumanoidRootPart", "BasePart")
  319. if hatcollide and c:FindFirstChildOfClass("Accessory") then
  320. local anything = c:FindFirstChildOfClass("BodyColors") or gp(c, "Health", "Script")
  321. if not (torso and root and anything) then
  322. return
  323. end
  324. torso:Destroy()
  325. root:Destroy()
  326. if shp then
  327. for i,v in pairs(c:GetChildren()) do
  328. if v:IsA("Accessory") then
  329. shp(v, "BackendAccoutrementState", 0)
  330. end
  331. end
  332. end
  333. anything:Destroy()
  334. end
  335.  
  336. local model = Instance.new("Model", c)
  337. model.Name = model.ClassName
  338.  
  339. model:GetPropertyChangedSignal("Parent"):Connect(function()
  340. if not (model and model.Parent) then
  341. model = nil
  342. end
  343. end)
  344.  
  345. for i, v in pairs(c:GetChildren()) do
  346. if v ~= model then
  347. if addtools and v:IsA("Tool") then
  348. for i1, v1 in pairs(v:GetDescendants()) do
  349. if v1 and v1.Parent and v1:IsA("BasePart") then
  350. local bv = Instance.new("BodyVelocity", v1)
  351. bv.Velocity = v3_0
  352. bv.MaxForce = v3(1000, 1000, 1000)
  353. bv.P = 1250
  354. bv.Name = "bv_" .. v.Name
  355. end
  356. end
  357. end
  358. v.Parent = model
  359. end
  360. end
  361.  
  362. if breakjoints then
  363. model:BreakJoints()
  364. else
  365. if head and torso then
  366. for i, v in pairs(model:GetDescendants()) do
  367. if v:IsA("Weld") or v:IsA("Snap") or v:IsA("Glue") or v:IsA("Motor") or v:IsA("Motor6D") then
  368. local save = false
  369. if (v.Part0 == torso) and (v.Part1 == head) then
  370. save = true
  371. end
  372. if (v.Part0 == head) and (v.Part1 == torso) then
  373. save = true
  374. end
  375. if save then
  376. if hedafterneck then
  377. hedafterneck = v
  378. end
  379. else
  380. v:Destroy()
  381. end
  382. end
  383. end
  384. end
  385. if method == 3 then
  386. spawn(function()
  387. wait(loadtime)
  388. if model then
  389. model:BreakJoints()
  390. end
  391. end)
  392. end
  393. end
  394.  
  395. cl.Parent = c
  396. for i, v in pairs(cl:GetChildren()) do
  397. v.Parent = c
  398. end
  399. cl:Destroy()
  400.  
  401. local noclipmodel = (noclipAllParts and c) or model
  402. local noclipcon = nil
  403. local function uncollide()
  404. if noclipmodel then
  405. for i, v in pairs(noclipmodel:GetDescendants()) do
  406. if v:IsA("BasePart") then
  407. v.CanCollide = false
  408. end
  409. end
  410. else
  411. noclipcon:Disconnect()
  412. end
  413. end
  414. noclipcon = stepped:Connect(uncollide)
  415. uncollide()
  416.  
  417. for i, scr in pairs(model:GetDescendants()) do
  418. if (scr.ClassName == "Script") and table.find(scriptNames, scr.Name) then
  419. local Part0 = scr.Parent
  420. if Part0:IsA("BasePart") then
  421. for i1, scr1 in pairs(c:GetDescendants()) do
  422. if (scr1.ClassName == "Script") and (scr1.Name == scr.Name) and (not scr1:IsDescendantOf(model)) then
  423. local Part1 = scr1.Parent
  424. if (Part1.ClassName == Part0.ClassName) and (Part1.Name == Part0.Name) then
  425. align(Part0, Part1)
  426. scr:Destroy()
  427. scr1:Destroy()
  428. break
  429. end
  430. end
  431. end
  432. end
  433. end
  434. end
  435.  
  436. for i, v in pairs(c:GetDescendants()) do
  437. if v and v.Parent and (not v:IsDescendantOf(model)) then
  438. if v:IsA("Decal") then
  439. v.Transparency = 1
  440. elseif v:IsA("BasePart") then
  441. v.Transparency = 1
  442. v.Anchored = false
  443. elseif v:IsA("ForceField") then
  444. v.Visible = false
  445. elseif v:IsA("Sound") then
  446. v.Playing = false
  447. elseif v:IsA("BillboardGui") or v:IsA("SurfaceGui") or v:IsA("ParticleEmitter") or v:IsA("Fire") or v:IsA("Smoke") or v:IsA("Sparkles") then
  448. v.Enabled = false
  449. end
  450. end
  451. end
  452.  
  453. if newanimate then
  454. local animate = gp(c, "Animate", "LocalScript")
  455. if animate then
  456. animate.Disabled = false
  457. end
  458. end
  459.  
  460. if addtools then
  461. for i, v in pairs(c:GetChildren()) do
  462. if v:IsA("Tool") then
  463. v.Parent = addtools
  464. end
  465. end
  466. end
  467.  
  468. local hum0 = model:FindFirstChildOfClass("Humanoid")
  469. if hum0 then
  470. hum0:GetPropertyChangedSignal("Parent"):Connect(function()
  471. if not (hum0 and hum0.Parent) then
  472. hum0 = nil
  473. end
  474. end)
  475. end
  476.  
  477. local hum1 = c:FindFirstChildOfClass("Humanoid")
  478. if hum1 then
  479. hum1:GetPropertyChangedSignal("Parent"):Connect(function()
  480. if not (hum1 and hum1.Parent) then
  481. hum1 = nil
  482. end
  483. end)
  484.  
  485. ws.CurrentCamera.CameraSubject = hum1
  486. local camSubCon = nil
  487. local function camSubFunc()
  488. camSubCon:Disconnect()
  489. if c and hum1 then
  490. ws.CurrentCamera.CameraSubject = hum1
  491. end
  492. end
  493. camSubCon = renderstepped:Connect(camSubFunc)
  494. if hum0 then
  495. hum0:GetPropertyChangedSignal("Jump"):Connect(function()
  496. if hum1 then
  497. hum1.Jump = hum0.Jump
  498. end
  499. end)
  500. else
  501. respawnrequest()
  502. end
  503. end
  504.  
  505. local rb = Instance.new("BindableEvent", c)
  506. rb.Event:Connect(function()
  507. rb:Destroy()
  508. sg:SetCore("ResetButtonCallback", true)
  509. if destroyhum then
  510. c:BreakJoints()
  511. return
  512. end
  513. if hum0 and (hum0.Health > 0) then
  514. model:BreakJoints()
  515. hum0.Health = 0
  516. end
  517. if antirespawn then
  518. respawnrequest()
  519. end
  520. end)
  521. sg:SetCore("ResetButtonCallback", rb)
  522.  
  523. spawn(function()
  524. while c do
  525. if hum0 and hum1 then
  526. hum1.Jump = hum0.Jump
  527. end
  528. wait()
  529. end
  530. sg:SetCore("ResetButtonCallback", true)
  531. end)
  532.  
  533. R15toR6 = R15toR6 and hum1 and (hum1.RigType == Enum.HumanoidRigType.R15)
  534. if R15toR6 then
  535. local part = gp(c, "HumanoidRootPart", "BasePart") or gp(c, "UpperTorso", "BasePart") or gp(c, "LowerTorso", "BasePart") or gp(c, "Head", "BasePart") or c:FindFirstChildWhichIsA("BasePart")
  536. if part then
  537. local cfr = part.CFrame
  538. local R6parts = {
  539. head = {
  540. Name = "Head",
  541. Size = v3(2, 1, 1),
  542. R15 = {
  543. Head = 0
  544. }
  545. },
  546. torso = {
  547. Name = "Torso",
  548. Size = v3(2, 2, 1),
  549. R15 = {
  550. UpperTorso = 0.2,
  551. LowerTorso = -0.8
  552. }
  553. },
  554. root = {
  555. Name = "HumanoidRootPart",
  556. Size = v3(2, 2, 1),
  557. R15 = {
  558. HumanoidRootPart = 0
  559. }
  560. },
  561. leftArm = {
  562. Name = "Left Arm",
  563. Size = v3(1, 2, 1),
  564. R15 = {
  565. LeftHand = -0.849,
  566. LeftLowerArm = -0.174,
  567. LeftUpperArm = 0.415
  568. }
  569. },
  570. rightArm = {
  571. Name = "Right Arm",
  572. Size = v3(1, 2, 1),
  573. R15 = {
  574. RightHand = -0.849,
  575. RightLowerArm = -0.174,
  576. RightUpperArm = 0.415
  577. }
  578. },
  579. leftLeg = {
  580. Name = "Left Leg",
  581. Size = v3(1, 2, 1),
  582. R15 = {
  583. LeftFoot = -0.85,
  584. LeftLowerLeg = -0.29,
  585. LeftUpperLeg = 0.49
  586. }
  587. },
  588. rightLeg = {
  589. Name = "Right Leg",
  590. Size = v3(1, 2, 1),
  591. R15 = {
  592. RightFoot = -0.85,
  593. RightLowerLeg = -0.29,
  594. RightUpperLeg = 0.49
  595. }
  596. }
  597. }
  598. for i, v in pairs(c:GetChildren()) do
  599. if v:IsA("BasePart") then
  600. for i1, v1 in pairs(v:GetChildren()) do
  601. if v1:IsA("Motor6D") then
  602. v1.Part0 = nil
  603. end
  604. end
  605. end
  606. end
  607. part.Archivable = true
  608. for i, v in pairs(R6parts) do
  609. local part = part:Clone()
  610. part:ClearAllChildren()
  611. part.Name = v.Name
  612. part.Size = v.Size
  613. part.CFrame = cfr
  614. part.Anchored = false
  615. part.Transparency = 1
  616. part.CanCollide = false
  617. for i1, v1 in pairs(v.R15) do
  618. local R15part = gp(c, i1, "BasePart")
  619. local att = gp(R15part, "att1_" .. i1, "Attachment")
  620. if R15part then
  621. local weld = Instance.new("Weld", R15part)
  622. weld.Name = "Weld_" .. i1
  623. weld.Part0 = part
  624. weld.Part1 = R15part
  625. weld.C0 = cf(0, v1, 0)
  626. weld.C1 = cf(0, 0, 0)
  627. R15part.Massless = true
  628. R15part.Name = "R15_" .. i1
  629. R15part.Parent = part
  630. if att then
  631. att.Parent = part
  632. att.Position = v3(0, v1, 0)
  633. end
  634. end
  635. end
  636. part.Parent = c
  637. R6parts[i] = part
  638. end
  639. local R6joints = {
  640. neck = {
  641. Parent = R6parts.torso,
  642. Name = "Neck",
  643. Part0 = R6parts.torso,
  644. Part1 = R6parts.head,
  645. C0 = cf(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
  646. C1 = cf(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  647. },
  648. rootJoint = {
  649. Parent = R6parts.root,
  650. Name = "RootJoint" ,
  651. Part0 = R6parts.root,
  652. Part1 = R6parts.torso,
  653. C0 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0),
  654. C1 = cf(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0)
  655. },
  656. rightShoulder = {
  657. Parent = R6parts.torso,
  658. Name = "Right Shoulder",
  659. Part0 = R6parts.torso,
  660. Part1 = R6parts.rightArm,
  661. C0 = cf(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
  662. C1 = cf(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  663. },
  664. leftShoulder = {
  665. Parent = R6parts.torso,
  666. Name = "Left Shoulder",
  667. Part0 = R6parts.torso,
  668. Part1 = R6parts.leftArm,
  669. C0 = cf(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
  670. C1 = cf(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  671. },
  672. rightHip = {
  673. Parent = R6parts.torso,
  674. Name = "Right Hip",
  675. Part0 = R6parts.torso,
  676. Part1 = R6parts.rightLeg,
  677. C0 = cf(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0),
  678. C1 = cf(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  679. },
  680. leftHip = {
  681. Parent = R6parts.torso,
  682. Name = "Left Hip" ,
  683. Part0 = R6parts.torso,
  684. Part1 = R6parts.leftLeg,
  685. C0 = cf(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0),
  686. C1 = cf(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  687. }
  688. }
  689. for i, v in pairs(R6joints) do
  690. local joint = Instance.new("Motor6D")
  691. for prop, val in pairs(v) do
  692. joint[prop] = val
  693. end
  694. R6joints[i] = joint
  695. end
  696. if hum1 then
  697. hum1.RigType = Enum.HumanoidRigType.R6
  698. hum1.HipHeight = 0
  699. end
  700. end
  701. end
  702.  
  703. local torso1 = torso
  704. torso = gp(c, "Torso", "BasePart") or ((not R15toR6) and gp(c, torso.Name, "BasePart"))
  705. if (typeof(hedafterneck) == "Instance") and head and torso and torso1 then
  706. local conNeck = nil
  707. local conTorso = nil
  708. local contorso1 = nil
  709. local aligns = {}
  710. local function enableAligns()
  711. conNeck:Disconnect()
  712. conTorso:Disconnect()
  713. conTorso1:Disconnect()
  714. for i, v in pairs(aligns) do
  715. v.Enabled = true
  716. end
  717. end
  718. conNeck = hedafterneck.Changed:Connect(function(prop)
  719. if table.find({"Part0", "Part1", "Parent"}, prop) then
  720. enableAligns()
  721. end
  722. end)
  723. conTorso = torso:GetPropertyChangedSignal("Parent"):Connect(enableAligns)
  724. conTorso1 = torso1:GetPropertyChangedSignal("Parent"):Connect(enableAligns)
  725. for i, v in pairs(head:GetDescendants()) do
  726. if v:IsA("AlignPosition") or v:IsA("AlignOrientation") then
  727. i = tostring(i)
  728. aligns[i] = v
  729. v:GetPropertyChangedSignal("Parent"):Connect(function()
  730. aligns[i] = nil
  731. end)
  732. v.Enabled = false
  733. end
  734. end
  735. end
  736.  
  737. local flingpart0 = gp(model, flingpart, "BasePart") or gp(gp(model, flingpart, "Accessory"), "Handle", "BasePart")
  738. local flingpart1 = gp(c, flingpart, "BasePart") or gp(gp(c, flingpart, "Accessory"), "Handle", "BasePart")
  739.  
  740. local fling = function() end
  741. if flingpart0 and flingpart1 then
  742. flingpart0:GetPropertyChangedSignal("Parent"):Connect(function()
  743. if not (flingpart0 and flingpart0.Parent) then
  744. flingpart0 = nil
  745. fling = function() end
  746. end
  747. end)
  748. flingpart0.Archivable = true
  749. flingpart1:GetPropertyChangedSignal("Parent"):Connect(function()
  750. if not (flingpart1 and flingpart1.Parent) then
  751. flingpart1 = nil
  752. fling = function() end
  753. end
  754. end)
  755. local att0 = gp(flingpart0, "att0_" .. flingpart0.Name, "Attachment")
  756. local att1 = gp(flingpart1, "att1_" .. flingpart1.Name, "Attachment")
  757. if att0 and att1 then
  758. att0:GetPropertyChangedSignal("Parent"):Connect(function()
  759. if not (att0 and att0.Parent) then
  760. att0 = nil
  761. fling = function() end
  762. end
  763. end)
  764. att1:GetPropertyChangedSignal("Parent"):Connect(function()
  765. if not (att1 and att1.Parent) then
  766. att1 = nil
  767. fling = function() end
  768. end
  769. end)
  770. local lastfling = nil
  771. local mouse = lp:GetMouse()
  772. fling = function(target, duration, rotVelocity)
  773. if typeof(target) == "Instance" then
  774. if target:IsA("BasePart") then
  775. target = target.Position
  776. elseif target:IsA("Model") then
  777. target = gp(target, "HumanoidRootPart", "BasePart") or gp(target, "Torso", "BasePart") or gp(target, "UpperTorso", "BasePart") or target:FindFirstChildWhichIsA("BasePart")
  778. if target then
  779. target = target.Position
  780. else
  781. return
  782. end
  783. elseif target:IsA("Humanoid") then
  784. local parent = target.Parent
  785. if not (parent and parent:IsA("Model")) then
  786. return
  787. end
  788. target = gp(target, "HumanoidRootPart", "BasePart") or gp(target, "Torso", "BasePart") or gp(target, "UpperTorso", "BasePart") or target:FindFirstChildWhichIsA("BasePart")
  789. if target then
  790. target = target.Position
  791. else
  792. return
  793. end
  794. else
  795. return
  796. end
  797. elseif typeof(target) == "CFrame" then
  798. target = target.Position
  799. elseif typeof(target) ~= "Vector3" then
  800. target = mouse.Hit
  801. if target then
  802. target = target.Position
  803. else
  804. return
  805. end
  806. end
  807. lastfling = target
  808. if type(duration) ~= "number" then
  809. duration = tonumber(duration) or 0.5
  810. end
  811. if typeof(rotVelocity) ~= "Vector3" then
  812. rotVelocity = v3(20000, 20000, 20000)
  813. end
  814. if not (target and flingpart0 and flingpart1 and att0 and att1) then
  815. return
  816. end
  817. local flingpart = flingpart0:Clone()
  818. flingpart.Transparency = 1
  819. flingpart.Size = v3(0.01, 0.01, 0.01)
  820. flingpart.CanCollide = false
  821. flingpart.Name = "flingpart_" .. flingpart0.Name
  822. flingpart.Anchored = true
  823. flingpart.Velocity = v3_0
  824. flingpart.RotVelocity = v3_0
  825. flingpart:GetPropertyChangedSignal("Parent"):Connect(function()
  826. if not (flingpart and flingpart.Parent) then
  827. flingpart = nil
  828. end
  829. end)
  830. flingpart.Parent = flingpart1
  831. if flingpart0.Transparency > 0.5 then
  832. flingpart0.Transparency = 0.5
  833. end
  834. att1.Parent = flingpart
  835. for i, v in pairs(att0:GetChildren()) do
  836. if v:IsA("AlignOrientation") then
  837. v.Enabled = false
  838. end
  839. end
  840. local con = nil
  841. con = heartbeat:Connect(function()
  842. if target and (lastfling == target) and flingpart and flingpart0 and flingpart1 and att0 and att1 then
  843. flingpart0.RotVelocity = rotVelocity
  844. flingpart.Position = target
  845. else
  846. con:Disconnect()
  847. end
  848. end)
  849. local rsteppedRotVel = v3(
  850. ((rotVelocity.X > 0) and -1) or 1,
  851. ((rotVelocity.Y > 0) and -1) or 1,
  852. ((rotVelocity.Z > 0) and -1) or 1
  853. )
  854. local con = nil
  855. con = renderstepped:Connect(function()
  856. if target and (lastfling == target) and flingpart and flingpart0 and flingpart1 and att0 and att1 then
  857. flingpart0.RotVelocity = rsteppedRotVel
  858. flingpart.Position = target
  859. else
  860. con:Disconnect()
  861. end
  862. end)
  863. wait(duration)
  864. if lastfling ~= target then
  865. if flingpart then
  866. if att1 and (att1.Parent == flingpart) then
  867. att1.Parent = flingpart1
  868. end
  869. flingpart:Destroy()
  870. end
  871. return
  872. end
  873. target = nil
  874. if not (flingpart and flingpart0 and flingpart1 and att0 and att1) then
  875. return
  876. end
  877. flingpart0.RotVelocity = v3_0
  878. att1.Parent = flingpart1
  879. for i, v in pairs(att0:GetChildren()) do
  880. if v:IsA("AlignOrientation") then
  881. v.Enabled = true
  882. end
  883. end
  884. if flingpart then
  885. flingpart:Destroy()
  886. end
  887. end
  888. end
  889. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement