HowAreYu

bodyconvert

Aug 9th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.77 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3. if plr.Character:FindFirstChild("Torso") then
  4. plr.Character.Torso["Right Shoulder"]:Destroy()
  5. plr.Character.Torso["Left Shoulder"]:Destroy()
  6. plr.Character.Torso["Right Hip"]:Destroy()
  7. plr.Character.Torso["Left Hip"]:Destroy()
  8. else
  9. plr.Character.RightUpperArm["RightShoulder"]:Destroy()
  10. plr.Character.LeftUpperArm["LeftShoulder"]:Destroy()
  11. plr.Character.RightUpperLeg["RightHip"]:Destroy()
  12. plr.Character.LeftUpperLeg["LeftHip"]:Destroy()
  13. end
  14.  
  15. local left_arm = plr.Character:FindFirstChild("Left Arm") or plr.Character:FindFirstChild("LeftUpperArm")
  16. local right_arm = plr.Character:FindFirstChild("Right Arm") or plr.Character:FindFirstChild("RightUpperArm")
  17. local torso = plr.Character:FindFirstChild("Torso") or plr.Character:FindFirstChild("UpperTorso")
  18. local right_leg = plr.Character:FindFirstChild("Right Leg") or plr.Character:FindFirstChild("RightUpperLeg")
  19. local left_leg = plr.Character:FindFirstChild("Left Leg") or plr.Character:FindFirstChild("LeftUpperLeg")
  20.  
  21.  
  22. plr.Character.Head.CanCollide = false
  23.  
  24. plr.Character.Head:GetPropertyChangedSignal("CanCollide"):Connect(function()
  25. plr.Character.Head.CanCollide = false
  26. end)
  27.  
  28. if plr.Character:FindFirstChild("LowerTorso") then
  29. plr.Character.LowerTorso.CanCollide = false
  30.  
  31. plr.Character.LowerTorso:GetPropertyChangedSignal("CanCollide"):Connect(function()
  32. plr.Character.LowerTorso.CanCollide = false
  33. end)
  34.  
  35. plr.Character.UpperTorso.CanCollide = false
  36.  
  37. plr.Character.UpperTorso:GetPropertyChangedSignal("CanCollide"):Connect(function()
  38. plr.Character.UpperTorso.CanCollide = false
  39. end)
  40. else
  41. plr.Character.Torso.CanCollide = false
  42.  
  43. plr.Character.Torso:GetPropertyChangedSignal("CanCollide"):Connect(function()
  44. plr.Character.Torso.CanCollide = false
  45. end)
  46. end
  47.  
  48. local char = game:GetObjects("rbxassetid://5527728997")[1]
  49.  
  50. char.Parent = plr.Character
  51. for _, v in pairs(char:GetDescendants()) do
  52. if v:IsA("BasePart") then
  53. local prt = v
  54. prt:GetPropertyChangedSignal("Transparency"):Connect(function()
  55. prt.Transparency = 1
  56. end)
  57. if v.Name ~= "Head" and v.Name ~= "Torso" and v.Name ~= "HumanoidRootPart" then
  58. prt.CanCollide = false
  59. prt:GetPropertyChangedSignal("CanCollide"):Connect(function()
  60. prt.CanCollide = false
  61. end)
  62. end
  63. end
  64. end
  65. local function nocollision(prt)
  66. for _, v in pairs(plr.Character:GetDescendants()) do
  67. if v:IsA("BasePart") then
  68. e = Instance.new("NoCollisionConstraint", v)
  69. e.Part0 = v
  70. e.Part1 = prt
  71. end
  72. end
  73. end
  74. for i, v in pairs(char:GetDescendants()) do
  75. if v:IsA("BasePart") then
  76. nocollision(v)
  77. end
  78. end
  79. spawn(function()
  80.  
  81. local Figure = char.Animate.Parent
  82. local Torso = Figure:WaitForChild("Torso")
  83. local RightShoulder = Torso:WaitForChild("Right Shoulder")
  84. local LeftShoulder = Torso:WaitForChild("Left Shoulder")
  85. local RightHip = Torso:WaitForChild("Right Hip")
  86. local LeftHip = Torso:WaitForChild("Left Hip")
  87. local Neck = Torso:WaitForChild("Neck")
  88. local Humanoid = Figure:WaitForChild("Humanoid")
  89. local pose = "Standing"
  90.  
  91. local currentAnim = ""
  92. local currentAnimInstance = nil
  93. local currentAnimTrack = nil
  94. local currentAnimKeyframeHandler = nil
  95. local currentAnimSpeed = 1.0
  96. local animTable = {}
  97. local animNames = {
  98. idle = {
  99. {
  100. id = "http://www.roblox.com/asset/?id=180435571",
  101. weight = 9
  102. },
  103. {
  104. id = "http://www.roblox.com/asset/?id=180435792",
  105. weight = 1
  106. }
  107. },
  108. walk = {
  109. {
  110. id = "http://www.roblox.com/asset/?id=180426354",
  111. weight = 10
  112. }
  113. },
  114. run = {
  115. {
  116. id = "run.xml",
  117. weight = 10
  118. }
  119. },
  120. jump = {
  121. {
  122. id = "http://www.roblox.com/asset/?id=125750702",
  123. weight = 10
  124. }
  125. },
  126. fall = {
  127. {
  128. id = "http://www.roblox.com/asset/?id=180436148",
  129. weight = 10
  130. }
  131. },
  132. climb = {
  133. {
  134. id = "http://www.roblox.com/asset/?id=180436334",
  135. weight = 10
  136. }
  137. },
  138. sit = {
  139. {
  140. id = "http://www.roblox.com/asset/?id=178130996",
  141. weight = 10
  142. }
  143. },
  144. toolnone = {
  145. {
  146. id = "http://www.roblox.com/asset/?id=182393478",
  147. weight = 10
  148. }
  149. },
  150. toolslash = {
  151. {
  152. id = "http://www.roblox.com/asset/?id=129967390",
  153. weight = 10
  154. }
  155. -- { id = "slash.xml", weight = 10 }
  156. },
  157. toollunge = {
  158. {
  159. id = "http://www.roblox.com/asset/?id=129967478",
  160. weight = 10
  161. }
  162. },
  163. wave = {
  164. {
  165. id = "http://www.roblox.com/asset/?id=128777973",
  166. weight = 10
  167. }
  168. },
  169. point = {
  170. {
  171. id = "http://www.roblox.com/asset/?id=128853357",
  172. weight = 10
  173. }
  174. },
  175. dance1 = {
  176. {
  177. id = "http://www.roblox.com/asset/?id=182435998",
  178. weight = 10
  179. },
  180. {
  181. id = "http://www.roblox.com/asset/?id=182491037",
  182. weight = 10
  183. },
  184. {
  185. id = "http://www.roblox.com/asset/?id=182491065",
  186. weight = 10
  187. }
  188. },
  189. dance2 = {
  190. {
  191. id = "http://www.roblox.com/asset/?id=182436842",
  192. weight = 10
  193. },
  194. {
  195. id = "http://www.roblox.com/asset/?id=182491248",
  196. weight = 10
  197. },
  198. {
  199. id = "http://www.roblox.com/asset/?id=182491277",
  200. weight = 10
  201. }
  202. },
  203. dance3 = {
  204. {
  205. id = "http://www.roblox.com/asset/?id=182436935",
  206. weight = 10
  207. },
  208. {
  209. id = "http://www.roblox.com/asset/?id=182491368",
  210. weight = 10
  211. },
  212. {
  213. id = "http://www.roblox.com/asset/?id=182491423",
  214. weight = 10
  215. }
  216. },
  217. laugh = {
  218. {
  219. id = "http://www.roblox.com/asset/?id=129423131",
  220. weight = 10
  221. }
  222. },
  223. cheer = {
  224. {
  225. id = "http://www.roblox.com/asset/?id=129423030",
  226. weight = 10
  227. }
  228. },
  229. }
  230. local dances = {
  231. "dance1",
  232. "dance2",
  233. "dance3"
  234. }
  235.  
  236. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  237. local emoteNames = {
  238. wave = false,
  239. point = false,
  240. dance1 = true,
  241. dance2 = true,
  242. dance3 = true,
  243. laugh = false,
  244. cheer = false
  245. }
  246.  
  247. local function configureAnimationSet(name, fileList)
  248. if (animTable[name] ~= nil) then
  249. for _, connection in pairs(animTable[name].connections) do
  250. connection:disconnect()
  251. end
  252. end
  253. animTable[name] = {}
  254. animTable[name].count = 0
  255. animTable[name].totalWeight = 0
  256. animTable[name].connections = {}
  257.  
  258. -- check for config values
  259. local config = char.Animate:FindFirstChild(name)
  260. if (config ~= nil) then
  261. -- print("Loading anims " .. name)
  262. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child)
  263. configureAnimationSet(name, fileList)
  264. end))
  265. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child)
  266. configureAnimationSet(name, fileList)
  267. end))
  268. local idx = 1
  269. for _, childPart in pairs(config:GetChildren()) do
  270. if (childPart:IsA("Animation")) then
  271. table.insert(animTable[name].connections, childPart.Changed:connect(function(property)
  272. configureAnimationSet(name, fileList)
  273. end))
  274. animTable[name][idx] = {}
  275. animTable[name][idx].anim = childPart
  276. local weightObject = childPart:FindFirstChild("Weight")
  277. if (weightObject == nil) then
  278. animTable[name][idx].weight = 1
  279. else
  280. animTable[name][idx].weight = weightObject.Value
  281. end
  282. animTable[name].count = animTable[name].count + 1
  283. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  284. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  285. idx = idx + 1
  286. end
  287. end
  288. end
  289.  
  290. -- fallback to defaults
  291. if (animTable[name].count <= 0) then
  292. for idx, anim in pairs(fileList) do
  293. animTable[name][idx] = {}
  294. animTable[name][idx].anim = Instance.new("Animation")
  295. animTable[name][idx].anim.Name = name
  296. animTable[name][idx].anim.AnimationId = anim.id
  297. animTable[name][idx].weight = anim.weight
  298. animTable[name].count = animTable[name].count + 1
  299. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  300. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  301. end
  302. end
  303. end
  304.  
  305. -- Setup animation objects
  306. local function scriptChildModified(child)
  307. local fileList = animNames[child.Name]
  308. if (fileList ~= nil) then
  309. configureAnimationSet(child.Name, fileList)
  310. end
  311. end
  312. spawn(function()
  313. while true do
  314. settings().Physics.AllowSleep = false
  315. plr.ReplicationFocus = workspace
  316. sethiddenproperty(game:GetService("Players").LocalPlayer, "MaximumSimulationRadius", math.pow(math.huge,math.huge)*math.huge)
  317. sethiddenproperty(game:GetService("Players").LocalPlayer, "SimulationRadius", math.pow(math.huge,math.huge)*math.huge)
  318. game:GetService("RunService").Stepped:wait()
  319. end
  320. end)
  321. char.Animate.ChildAdded:connect(scriptChildModified)
  322. char.Animate.ChildRemoved:connect(scriptChildModified)
  323.  
  324.  
  325. for name, fileList in pairs(animNames) do
  326. configureAnimationSet(name, fileList)
  327. end
  328.  
  329. -- ANIMATION
  330.  
  331. -- declarations
  332. local toolAnim = "None"
  333. local toolAnimTime = 0
  334.  
  335. local jumpAnimTime = 0
  336. local jumpAnimDuration = 0.3
  337.  
  338. local toolTransitionTime = 0.1
  339. local fallTransitionTime = 0.3
  340. local jumpMaxLimbVelocity = 0.75
  341.  
  342. -- functions
  343.  
  344. local function stopAllAnimations()
  345. local oldAnim = currentAnim
  346.  
  347. -- return to idle if finishing an emote
  348. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  349. oldAnim = "idle"
  350. end
  351.  
  352. currentAnim = ""
  353. currentAnimInstance = nil
  354. if (currentAnimKeyframeHandler ~= nil) then
  355. currentAnimKeyframeHandler:disconnect()
  356. end
  357.  
  358. if (currentAnimTrack ~= nil) then
  359. currentAnimTrack:Stop()
  360. currentAnimTrack:Destroy()
  361. currentAnimTrack = nil
  362. end
  363. return oldAnim
  364. end
  365.  
  366. local function setAnimationSpeed(speed)
  367. if speed ~= currentAnimSpeed then
  368. currentAnimSpeed = speed
  369. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  370. end
  371. end
  372.  
  373. local function keyFrameReachedFunc(frameName)
  374. if (frameName == "End") then
  375.  
  376. local repeatAnim = currentAnim
  377. -- return to idle if finishing an emote
  378. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  379. repeatAnim = "idle"
  380. end
  381.  
  382. local animSpeed = currentAnimSpeed
  383. playAnimation(repeatAnim, 0.0, Humanoid)
  384. setAnimationSpeed(animSpeed)
  385. end
  386. end
  387.  
  388. -- Preload animations
  389. function playAnimation(animName, transitionTime, humanoid)
  390.  
  391. local roll = math.random(1, animTable[animName].totalWeight)
  392. local origRoll = roll
  393. local idx = 1
  394. while (roll > animTable[animName][idx].weight) do
  395. roll = roll - animTable[animName][idx].weight
  396. idx = idx + 1
  397. end
  398. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  399. local anim = animTable[animName][idx].anim
  400.  
  401. -- switch animation
  402. if (anim ~= currentAnimInstance) then
  403.  
  404. if (currentAnimTrack ~= nil) then
  405. currentAnimTrack:Stop(transitionTime)
  406. currentAnimTrack:Destroy()
  407. end
  408.  
  409. currentAnimSpeed = 1.0
  410.  
  411. -- load it to the humanoid; get AnimationTrack
  412. currentAnimTrack = humanoid:LoadAnimation(anim)
  413. currentAnimTrack.Priority = Enum.AnimationPriority.Core
  414.  
  415. -- play the animation
  416. currentAnimTrack:Play(transitionTime)
  417. currentAnim = animName
  418. currentAnimInstance = anim
  419.  
  420. -- set up keyframe name triggers
  421. if (currentAnimKeyframeHandler ~= nil) then
  422. currentAnimKeyframeHandler:disconnect()
  423. end
  424. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  425.  
  426. end
  427.  
  428. end
  429.  
  430. -------------------------------------------------------------------------------------------
  431. -------------------------------------------------------------------------------------------
  432.  
  433. local toolAnimName = ""
  434. local toolAnimTrack = nil
  435. local toolAnimInstance = nil
  436. local currentToolAnimKeyframeHandler = nil
  437.  
  438. function toolKeyFrameReachedFunc(frameName)
  439. if (frameName == "End") then
  440. -- print("Keyframe : ".. frameName)
  441. playToolAnimation(toolAnimName, 0.0, Humanoid)
  442. end
  443. end
  444.  
  445.  
  446. function playToolAnimation(animName, transitionTime, humanoid, priority)
  447.  
  448. local roll = math.random(1, animTable[animName].totalWeight)
  449. local origRoll = roll
  450. local idx = 1
  451. while (roll > animTable[animName][idx].weight) do
  452. roll = roll - animTable[animName][idx].weight
  453. idx = idx + 1
  454. end
  455. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  456. local anim = animTable[animName][idx].anim
  457.  
  458. if (toolAnimInstance ~= anim) then
  459.  
  460. if (toolAnimTrack ~= nil) then
  461. toolAnimTrack:Stop()
  462. toolAnimTrack:Destroy()
  463. transitionTime = 0
  464. end
  465.  
  466. -- load it to the humanoid; get AnimationTrack
  467. toolAnimTrack = humanoid:LoadAnimation(anim)
  468. if priority then
  469. toolAnimTrack.Priority = priority
  470. end
  471.  
  472. -- play the animation
  473. toolAnimTrack:Play(transitionTime)
  474. toolAnimName = animName
  475. toolAnimInstance = anim
  476.  
  477. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  478. end
  479. end
  480.  
  481. function stopToolAnimations()
  482. local oldAnim = toolAnimName
  483.  
  484. if (currentToolAnimKeyframeHandler ~= nil) then
  485. currentToolAnimKeyframeHandler:disconnect()
  486. end
  487.  
  488. toolAnimName = ""
  489. toolAnimInstance = nil
  490. if (toolAnimTrack ~= nil) then
  491. toolAnimTrack:Stop()
  492. toolAnimTrack:Destroy()
  493. toolAnimTrack = nil
  494. end
  495.  
  496.  
  497. return oldAnim
  498. end
  499.  
  500. -------------------------------------------------------------------------------------------
  501. -------------------------------------------------------------------------------------------
  502.  
  503.  
  504. function onRunning(speed)
  505. if speed > 0.01 then
  506. playAnimation("walk", 0.1, Humanoid)
  507. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  508. setAnimationSpeed(speed / 14.5)
  509. end
  510. pose = "Running"
  511. else
  512. if emoteNames[currentAnim] == nil then
  513. playAnimation("idle", 0.1, Humanoid)
  514. pose = "Standing"
  515. end
  516. end
  517. end
  518.  
  519. function onDied()
  520. pose = "Dead"
  521. end
  522.  
  523. function onJumping()
  524. playAnimation("jump", 0.1, Humanoid)
  525. jumpAnimTime = jumpAnimDuration
  526. pose = "Jumping"
  527. end
  528.  
  529. function onClimbing(speed)
  530. playAnimation("climb", 0.1, Humanoid)
  531. setAnimationSpeed(speed / 12.0)
  532. pose = "Climbing"
  533. end
  534.  
  535. function onGettingUp()
  536. pose = "GettingUp"
  537. end
  538.  
  539. function onFreeFall()
  540. if (jumpAnimTime <= 0) then
  541. playAnimation("fall", fallTransitionTime, Humanoid)
  542. end
  543. pose = "FreeFall"
  544. end
  545.  
  546. function onFallingDown()
  547. pose = "FallingDown"
  548. end
  549.  
  550. function onSeated()
  551. pose = "Seated"
  552. end
  553.  
  554. function onPlatformStanding()
  555. pose = "PlatformStanding"
  556. end
  557.  
  558. function onSwimming(speed)
  559. if speed > 0 then
  560. pose = "Running"
  561. else
  562. pose = "Standing"
  563. end
  564. end
  565.  
  566. function getTool()
  567. for _, kid in ipairs(Figure:GetChildren()) do
  568. if kid.className == "Tool" then
  569. return kid
  570. end
  571. end
  572. return nil
  573. end
  574.  
  575. function getToolAnim(tool)
  576. for _, c in ipairs(tool:GetChildren()) do
  577. if c.Name == "toolanim" and c.className == "StringValue" then
  578. return c
  579. end
  580. end
  581. return nil
  582. end
  583.  
  584. function animateTool()
  585.  
  586. if (toolAnim == "None") then
  587. playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
  588. return
  589. end
  590.  
  591. if (toolAnim == "Slash") then
  592. playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
  593. return
  594. end
  595.  
  596. if (toolAnim == "Lunge") then
  597. playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
  598. return
  599. end
  600. end
  601.  
  602. function moveSit()
  603. RightShoulder.MaxVelocity = 0.15
  604. LeftShoulder.MaxVelocity = 0.15
  605. RightShoulder:SetDesiredAngle(3.14 / 2)
  606. LeftShoulder:SetDesiredAngle(-3.14 / 2)
  607. RightHip:SetDesiredAngle(3.14 / 2)
  608. LeftHip:SetDesiredAngle(-3.14 / 2)
  609. end
  610.  
  611. local lastTick = 0
  612.  
  613. function move(time)
  614. local amplitude = 1
  615. local frequency = 1
  616. local deltaTime = time - lastTick
  617. lastTick = time
  618.  
  619. local climbFudge = 0
  620. local setAngles = false
  621.  
  622. if (jumpAnimTime > 0) then
  623. jumpAnimTime = jumpAnimTime - deltaTime
  624. end
  625.  
  626. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  627. playAnimation("fall", fallTransitionTime, Humanoid)
  628. elseif (pose == "Seated") then
  629. playAnimation("sit", 0.5, Humanoid)
  630. return
  631. elseif (pose == "Running") then
  632. playAnimation("walk", 0.1, Humanoid)
  633. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  634. -- print("Wha " .. pose)
  635. stopAllAnimations()
  636. amplitude = 0.1
  637. frequency = 1
  638. setAngles = true
  639. end
  640.  
  641. if (setAngles) then
  642. local desiredAngle = amplitude * math.sin(time * frequency)
  643.  
  644. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  645. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  646. RightHip:SetDesiredAngle(-desiredAngle)
  647. LeftHip:SetDesiredAngle(-desiredAngle)
  648. end
  649.  
  650. -- Tool Animation handling
  651. local tool = getTool()
  652. if tool and tool:FindFirstChild("Handle") then
  653.  
  654. local animStringValueObject = getToolAnim(tool)
  655.  
  656. if animStringValueObject then
  657. toolAnim = animStringValueObject.Value
  658. -- message recieved, delete StringValue
  659. animStringValueObject.Parent = nil
  660. toolAnimTime = time + .3
  661. end
  662.  
  663. if time > toolAnimTime then
  664. toolAnimTime = 0
  665. toolAnim = "None"
  666. end
  667.  
  668. animateTool()
  669. else
  670. stopToolAnimations()
  671. toolAnim = "None"
  672. toolAnimInstance = nil
  673. toolAnimTime = 0
  674. end
  675. end
  676.  
  677. -- connect events
  678. Humanoid.Died:connect(onDied)
  679. Humanoid.Running:connect(onRunning)
  680. Humanoid.Jumping:connect(onJumping)
  681. Humanoid.Climbing:connect(onClimbing)
  682. Humanoid.GettingUp:connect(onGettingUp)
  683. Humanoid.FreeFalling:connect(onFreeFall)
  684. Humanoid.FallingDown:connect(onFallingDown)
  685. Humanoid.Seated:connect(onSeated)
  686. Humanoid.PlatformStanding:connect(onPlatformStanding)
  687. Humanoid.Swimming:connect(onSwimming)
  688.  
  689. -- setup emote chat hook
  690. plr.Chatted:connect(function(msg)
  691. local emote = ""
  692. if msg == "/e dance" then
  693. emote = dances[math.random(1, #dances)]
  694. elseif (string.sub(msg, 1, 3) == "/e ") then
  695. emote = string.sub(msg, 4)
  696. elseif (string.sub(msg, 1, 7) == "/emote ") then
  697. emote = string.sub(msg, 8)
  698. end
  699.  
  700. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  701. playAnimation(emote, 0.1, Humanoid)
  702. end
  703.  
  704. end)
  705.  
  706.  
  707. -- main program
  708.  
  709. -- initialize to idle
  710. playAnimation("idle", 0.1, Humanoid)
  711. pose = "Standing"
  712.  
  713. while Figure.Parent ~= nil do
  714. local _, time = wait(0.1)
  715. move(time)
  716. end
  717. end)
  718. function makeorientacc()
  719. AlignOrient = Instance.new("AlignOrientation")
  720. AlignOrient.RigidityEnabled = false
  721. AlignOrient.MaxTorque = 9e99
  722. AlignOrient.MaxAngularVelocity = 9e99
  723. AlignOrient.PrimaryAxisOnly = false
  724. AlignOrient.ReactionTorqueEnabled = true
  725. AlignOrient.Responsiveness = 200
  726. return (AlignOrient)
  727. end
  728. function makealignacc()
  729. AlignPos = Instance.new("AlignPosition")
  730. AlignPos.RigidityEnabled = false
  731. AlignPos.ApplyAtCenterOfMass = true
  732. AlignPos.MaxForce = 38493982
  733. AlignPos.MaxVelocity = 9e99
  734. AlignPos.ReactionForceEnabled = false
  735. AlignPos.Responsiveness = 9e99
  736. return (AlignPos)
  737. end
  738. function weldm(prt, prt2, offset, tr)
  739. prt.Massless = true
  740. --prt:BreakJoints()
  741. laacc = Instance.new("Attachment", prt)
  742. la3acc = Instance.new("Attachment", prt)
  743. la2acc = Instance.new("Attachment", prt2)
  744. la2acc.CFrame = offset
  745. LaAli = makealignacc()
  746. LaAli.Attachment0 = laacc
  747. LaAli.Attachment1 = la2acc
  748. LaAli.Parent = prt
  749. LaAli = makeorientacc()
  750. LaAli.Attachment0 = la3acc
  751. LaAli.Attachment1 = la2acc
  752. LaAli.Parent = prt
  753. end
  754. weldm(left_arm, char["Left Arm"], CFrame.Angles(0, 0, 0))
  755. weldm(right_arm, char["Right Arm"], CFrame.Angles(0, 0, 0))
  756. weldm(left_leg, char["Left Leg"], CFrame.Angles(0, 0, 0))
  757. weldm(right_leg, char["Right Leg"], CFrame.Angles(0, 0, 0))
  758. weldm(torso, char["Torso"], CFrame.new(0, 0.5, 0))
  759.  
  760. char:MoveTo(plr.Character.HumanoidRootPart.CFrame.Position)
  761. plr.Character.Animate.Disabled = true
  762. if plr.Character:FindFirstChild("Torso") then
  763. plr.Character.HumanoidRootPart.RootJoint:Destroy()
  764. else
  765. plr.Character.LowerTorso.Root:Destroy()
  766. end
  767. Humanoid = plr.Character.Humanoid
  768. char.HumanoidRootPart.Anchored = false
  769. game.Workspace.CurrentCamera.CameraSubject = char.Humanoid
  770. local render_stepped = game.RunService.RenderStepped:Connect(function()
  771. local ActiveTracks = Humanoid:GetPlayingAnimationTracks()
  772. for _, v in pairs(ActiveTracks) do
  773. v:Stop()
  774. end
  775.  
  776. end)
  777. plr.Character.HumanoidRootPart:Destroy()
  778. local oc = plr.Character
  779. on_died = char.Humanoid.Died:Connect(function()
  780. plr.Character = oc
  781. oc.Humanoid.Health = 0
  782. oc:BreakJoints()
  783. char.Humanoid.Health = 0
  784. char:BreakJoints()
  785. char:Destroy()
  786. end)
  787. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
  788. plr.Character = char
  789. spawn(function()
  790. wait(1)
  791. game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true)
  792. end)
  793. while char.Parent ~= nil do
  794. wait()
  795. end
  796. render_stepped:Disconnect()
  797. on_died:Disconnect()
Add Comment
Please, Sign In to add comment