Deyer

Untitled

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