rrixh

fe kreepykrawler

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