Advertisement
Deyer

Untitled

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