Advertisement
NeverCords

Untitled

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