Advertisement
Deyer

Old Reanim

Mar 23rd, 2023
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.56 KB | None | 0 0
  1. local v3_net, v3_808 = Vector3.new(20000, 25.1, 0.1), Vector3.new(8, 0, 8)
  2. local function getNetlessVelocity(realPartVelocity)
  3. if realPartVelocity.Magnitude > 1 then
  4. local unit = realPartVelocity.Unit
  5. if (unit.Y > 0.25) or (unit.Y < -0.75) then
  6. return unit * (25.1 / unit.Y)
  7. end
  8. end
  9. return v3_net + realPartVelocity * v3_808
  10. end
  11. local simradius = "shp" --simulation radius (net bypass) method
  12. --"shp" - sethiddenproperty
  13. --"ssr" - setsimulationradius
  14. --false - disable
  15. local simrad = 1000 --simulation radius value
  16. local healthHide = true --moves your head away every 3 seconds so players dont see your health bar (alignmode 4 only)
  17. 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)
  18. local novoid = true --prevents parts from going under workspace.FallenPartsDestroyHeight if you control them (alignmode 4 only)
  19. local physp = nil --PhysicalProperties.new(0.01, 0, 1, 0, 0) --sets .CustomPhysicalProperties to this for each part
  20. local noclipAllParts = false --set it to true if you want noclip
  21. local antiragdoll = true --removes hingeConstraints and ballSocketConstraints from your character
  22. local newanimate = true --disables the animate script and enables after reanimation
  23. local discharscripts = true --disables all localScripts parented to your character before reanimation
  24. local R15toR6 = true --tries to convert your character to r6 if its r15
  25. local hatcollide = true --makes hats cancollide (credit to ShownApe) (works only with reanimate method 0)
  26. local humState16 = true --enables collisions for limbs before the humanoid dies (using hum:ChangeState)
  27. local addtools = false --puts all tools from backpack to character and lets you hold them after reanimation
  28. local hedafterneck = true --disable aligns for head and enable after neck or torso is removed
  29. local loadtime = game:GetService("Players").RespawnTime + 0.5 --anti respawn delay
  30. local method = 3 --reanimation method
  31. --methods:
  32. --0 - breakJoints (takes [loadtime] seconds to load)
  33. --1 - limbs
  34. --2 - limbs + anti respawn
  35. --3 - limbs + breakJoints after [loadtime] seconds
  36. --4 - remove humanoid + breakJoints
  37. --5 - remove humanoid + limbs
  38. local alignmode = 4 --AlignPosition mode
  39. --modes:
  40. --1 - AlignPosition rigidity enabled true
  41. --2 - 2 AlignPositions rigidity enabled both true and false
  42. --3 - AlignPosition rigidity enabled false
  43. --4 - no AlignPosition, CFrame only
  44. local flingpart = "HumanoidRootPart" --name of the part or the hat used for flinging
  45. --the fling function
  46. --usage: fling(target, duration, velocity)
  47. --target can be set to: basePart, CFrame, Vector3, character model or humanoid (flings at mouse.Hit if argument not provided)
  48. --duration (fling time in seconds) can be set to a number or a string convertable to a number (0.5s if not provided)
  49. --velocity (fling part rotation velocity) can be set to a vector3 value (Vector3.new(20000, 20000, 20000) if not provided)
  50.  
  51. local lp = game:GetService("Players").LocalPlayer
  52. local rs, ws, sg = game:GetService("RunService"), game:GetService("Workspace"), game:GetService("StarterGui")
  53. local stepped, heartbeat, renderstepped = rs.Stepped, rs.Heartbeat, rs.RenderStepped
  54. local twait, tdelay, rad, inf, abs, clamp = task.wait, task.delay, math.rad, math.huge, math.abs, math.clamp
  55. local cf, v3, angles = CFrame.new, Vector3.new, CFrame.Angles
  56. local v3_0, cf_0 = v3(0, 0, 0), cf(0, 0, 0)
  57.  
  58. local c = lp.Character
  59. if not (c and c.Parent) then
  60. return
  61. end
  62.  
  63. c:GetPropertyChangedSignal("Parent"):Connect(function()
  64. if not (c and c.Parent) then
  65. c = nil
  66. end
  67. end)
  68.  
  69. local clone, destroy, getchildren, getdescendants, isa = c.Clone, c.Destroy, c.GetChildren, c.GetDescendants, c.IsA
  70.  
  71. local function gp(parent, name, className)
  72. if typeof(parent) == "Instance" then
  73. for i, v in pairs(getchildren(parent)) do
  74. if (v.Name == name) and isa(v, className) then
  75. return v
  76. end
  77. end
  78. end
  79. return nil
  80. end
  81.  
  82. local fenv = getfenv()
  83.  
  84. local shp = fenv.sethiddenproperty or fenv.set_hidden_property or fenv.set_hidden_prop or fenv.sethiddenprop
  85. 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
  86.  
  87. healthHide = healthHide and ((method == 0) or (method == 2) or (method == 3)) and gp(c, "Head", "BasePart")
  88.  
  89. local reclaim, lostpart = reclaim and c.PrimaryPart, nil
  90.  
  91. local function align(Part0, Part1)
  92.  
  93. local att0 = Instance.new("Attachment")
  94. att0.Position, att0.Orientation, att0.Name = v3_0, v3_0, "att0_" .. Part0.Name
  95. local att1 = Instance.new("Attachment")
  96. att1.Position, att1.Orientation, att1.Name = v3_0, v3_0, "att1_" .. Part1.Name
  97.  
  98. if alignmode == 4 then
  99.  
  100. local hide = false
  101. if Part0 == healthHide then
  102. healthHide = false
  103. tdelay(0, function()
  104. while twait(2.9) and Part0 and c do
  105. hide = #Part0:GetConnectedParts() == 1
  106. twait(0.1)
  107. hide = false
  108. end
  109. end)
  110. end
  111.  
  112. local rot = rad(0.05)
  113. local con0, con1 = nil, nil
  114. con0 = stepped:Connect(function()
  115. if not (Part0 and Part1) then return con0:Disconnect() and con1:Disconnect() end
  116. Part0.RotVelocity = Part1.RotVelocity
  117. end)
  118. local lastpos = Part0.Position
  119. con1 = heartbeat:Connect(function(delta)
  120. if not (Part0 and Part1 and att1) then return con0:Disconnect() and con1:Disconnect() end
  121. if (not Part0.Anchored) and (Part0.ReceiveAge == 0) then
  122. if lostpart == Part0 then
  123. lostpart = nil
  124. end
  125. local newcf = Part1.CFrame * att1.CFrame
  126. if Part1.Velocity.Magnitude > 0.1 then
  127. Part0.Velocity = getNetlessVelocity(Part1.Velocity)
  128. else
  129. local vel = (newcf.Position - lastpos) / delta
  130. Part0.Velocity = getNetlessVelocity(vel)
  131. if vel.Magnitude < 1 then
  132. rot = -rot
  133. newcf *= angles(0, 0, rot)
  134. end
  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. --the default roblox animate script edited and put in one line
  719. local script = gp(c, "Animate", "LocalScript") if not script.Disabled then script:ClearAllChildren() local Torso = gp(c, "Torso", "BasePart") local RightShoulder = gp(Torso, "Right Shoulder", "Motor6D") local LeftShoulder = gp(Torso, "Left Shoulder", "Motor6D") local RightHip = gp(Torso, "Right Hip", "Motor6D") local LeftHip = gp(Torso, "Left Hip", "Motor6D") local Neck = gp(Torso, "Neck", "Motor6D") local Humanoid = c:FindFirstChildOfClass("Humanoid") local pose = "Standing" local currentAnim = "" local currentAnimInstance = nil local currentAnimTrack = nil local currentAnimKeyframeHandler = nil local currentAnimSpeed = 1.0 local animTable = {} local animNames = { idle = { { id = "http://www.roblox.com/asset/?id=180435571", weight = 9 }, { id = "http://www.roblox.com/asset/?id=180435792", weight = 1 } }, walk = { { id = "http://www.roblox.com/asset/?id=180426354", weight = 10 } }, run = { { id = "run.xml", weight = 10 } }, jump = { { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } }, fall = { { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 } }, climb = { { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 } }, sit = { { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 } }, toolnone = { { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 } }, toolslash = { { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } }, toollunge = { { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } }, wave = { { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } }, point = { { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } }, dance1 = { { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 } }, dance2 = { { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 } }, dance3 = { { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 }, { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 } }, laugh = { { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } }, cheer = { { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } }, } local dances = {"dance1", "dance2", "dance3"} local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false} local function configureAnimationSet(name, fileList) if (animTable[name] ~= nil) then for _, connection in pairs(animTable[name].connections) do connection:disconnect() end end animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 animTable[name].connections = {} local config = script:FindFirstChild(name) if (config ~= nil) then table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) local idx = 1 for _, childPart in pairs(config:GetChildren()) do if (childPart:IsA("Animation")) then table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) animTable[name][idx] = {} animTable[name][idx].anim = childPart local weightObject = childPart:FindFirstChild("Weight") if (weightObject == nil) then animTable[name][idx].weight = 1 else animTable[name][idx].weight = weightObject.Value end animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight idx = idx + 1 end end end if (animTable[name].count <= 0) then for idx, anim in pairs(fileList) do animTable[name][idx] = {} animTable[name][idx].anim = Instance.new("Animation") animTable[name][idx].anim.Name = name animTable[name][idx].anim.AnimationId = anim.id animTable[name][idx].weight = anim.weight animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + anim.weight end end end local function scriptChildModified(child) local fileList = animNames[child.Name] if (fileList ~= nil) then configureAnimationSet(child.Name, fileList) end end script.ChildAdded:connect(scriptChildModified) script.ChildRemoved:connect(scriptChildModified) local animator = Humanoid and Humanoid:FindFirstChildOfClass("Animator") or nil if animator then local animTracks = animator:GetPlayingAnimationTracks() for i, track in ipairs(animTracks) do track:Stop(0) track:Destroy() end end for name, fileList in pairs(animNames) do configureAnimationSet(name, fileList) end local toolAnim = "None" local toolAnimTime = 0 local jumpAnimTime = 0 local jumpAnimDuration = 0.3 local toolTransitionTime = 0.1 local fallTransitionTime = 0.3 local jumpMaxLimbVelocity = 0.75 local function stopAllAnimations() local oldAnim = currentAnim if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then oldAnim = "idle" end currentAnim = "" currentAnimInstance = nil if (currentAnimKeyframeHandler ~= nil) then currentAnimKeyframeHandler:disconnect() end if (currentAnimTrack ~= nil) then currentAnimTrack:Stop() currentAnimTrack:Destroy() currentAnimTrack = nil end return oldAnim end local function playAnimation(animName, transitionTime, humanoid) local roll = math.random(1, animTable[animName].totalWeight) local origRoll = roll local idx = 1 while (roll > animTable[animName][idx].weight) do roll = roll - animTable[animName][idx].weight idx = idx + 1 end local anim = animTable[animName][idx].anim if (anim ~= currentAnimInstance) then if (currentAnimTrack ~= nil) then currentAnimTrack:Stop(transitionTime) currentAnimTrack:Destroy() end currentAnimSpeed = 1.0 currentAnimTrack = humanoid:LoadAnimation(anim) currentAnimTrack.Priority = Enum.AnimationPriority.Core currentAnimTrack:Play(transitionTime) currentAnim = animName currentAnimInstance = anim if (currentAnimKeyframeHandler ~= nil) then currentAnimKeyframeHandler:disconnect() end currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc) end end local function setAnimationSpeed(speed) if speed ~= currentAnimSpeed then currentAnimSpeed = speed currentAnimTrack:AdjustSpeed(currentAnimSpeed) end end local function keyFrameReachedFunc(frameName) if (frameName == "End") then local repeatAnim = currentAnim if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then repeatAnim = "idle" end local animSpeed = currentAnimSpeed playAnimation(repeatAnim, 0.0, Humanoid) setAnimationSpeed(animSpeed) end end local toolAnimName = "" local toolAnimTrack = nil local toolAnimInstance = nil local currentToolAnimKeyframeHandler = nil local function toolKeyFrameReachedFunc(frameName) if (frameName == "End") then playToolAnimation(toolAnimName, 0.0, Humanoid) end end local function playToolAnimation(animName, transitionTime, humanoid, priority) local roll = math.random(1, animTable[animName].totalWeight) local origRoll = roll local idx = 1 while (roll > animTable[animName][idx].weight) do roll = roll - animTable[animName][idx].weight idx = idx + 1 end local anim = animTable[animName][idx].anim if (toolAnimInstance ~= anim) then if (toolAnimTrack ~= nil) then toolAnimTrack:Stop() toolAnimTrack:Destroy() transitionTime = 0 end toolAnimTrack = humanoid:LoadAnimation(anim) if priority then toolAnimTrack.Priority = priority end toolAnimTrack:Play(transitionTime) toolAnimName = animName toolAnimInstance = anim currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc) end end local function stopToolAnimations() local oldAnim = toolAnimName if (currentToolAnimKeyframeHandler ~= nil) then currentToolAnimKeyframeHandler:disconnect() end toolAnimName = "" toolAnimInstance = nil if (toolAnimTrack ~= nil) then toolAnimTrack:Stop() toolAnimTrack:Destroy() toolAnimTrack = nil end return oldAnim end local function onRunning(speed) if speed > 0.01 then playAnimation("walk", 0.1, Humanoid) if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then setAnimationSpeed(speed / 14.5) end pose = "Running" else if emoteNames[currentAnim] == nil then playAnimation("idle", 0.1, Humanoid) pose = "Standing" end end end local function onDied() pose = "Dead" end local function onJumping() playAnimation("jump", 0.1, Humanoid) jumpAnimTime = jumpAnimDuration pose = "Jumping" end local function onClimbing(speed) playAnimation("climb", 0.1, Humanoid) setAnimationSpeed(speed / 12.0) pose = "Climbing" end local function onGettingUp() pose = "GettingUp" end local function onFreeFall() if (jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) end pose = "FreeFall" end local function onFallingDown() pose = "FallingDown" end local function onSeated() pose = "Seated" end local function onPlatformStanding() pose = "PlatformStanding" end local function onSwimming(speed) if speed > 0 then pose = "Running" else pose = "Standing" end end local function getTool() return c and c:FindFirstChildOfClass("Tool") end local function getToolAnim(tool) for _, c in ipairs(tool:GetChildren()) do if c.Name == "toolanim" and c.className == "StringValue" then return c end end return nil end local function animateTool() if (toolAnim == "None") then playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle) return end if (toolAnim == "Slash") then playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action) return end if (toolAnim == "Lunge") then playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action) return end end local function moveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder:SetDesiredAngle(3.14 /2) LeftShoulder:SetDesiredAngle(-3.14 /2) RightHip:SetDesiredAngle(3.14 /2) LeftHip:SetDesiredAngle(-3.14 /2) end local lastTick = 0 local function move(time) local amplitude = 1 local frequency = 1 local deltaTime = time - lastTick lastTick = time local climbFudge = 0 local setAngles = false if (jumpAnimTime > 0) then jumpAnimTime = jumpAnimTime - deltaTime end if (pose == "FreeFall" and jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) elseif (pose == "Seated") then playAnimation("sit", 0.5, Humanoid) return elseif (pose == "Running") then playAnimation("walk", 0.1, Humanoid) elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then stopAllAnimations() amplitude = 0.1 frequency = 1 setAngles = true end if (setAngles) then local desiredAngle = amplitude * math.sin(time * frequency) RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) RightHip:SetDesiredAngle(-desiredAngle) LeftHip:SetDesiredAngle(-desiredAngle) end local tool = getTool() if tool and tool:FindFirstChild("Handle") then local animStringValueObject = getToolAnim(tool) if animStringValueObject then toolAnim = animStringValueObject.Value animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else stopToolAnimations() toolAnim = "None" toolAnimInstance = nil toolAnimTime = 0 end end Humanoid.Died:connect(onDied) Humanoid.Running:connect(onRunning) Humanoid.Jumping:connect(onJumping) Humanoid.Climbing:connect(onClimbing) Humanoid.GettingUp:connect(onGettingUp) Humanoid.FreeFalling:connect(onFreeFall) Humanoid.FallingDown:connect(onFallingDown) Humanoid.Seated:connect(onSeated) Humanoid.PlatformStanding:connect(onPlatformStanding) Humanoid.Swimming:connect(onSwimming) game:GetService("Players").LocalPlayer.Chatted:connect(function(msg) local emote = "" if msg == "/e dance" then emote = dances[math.random(1, #dances)] elseif (string.sub(msg, 1, 3) == "/e ") then emote = string.sub(msg, 4) elseif (string.sub(msg, 1, 7) == "/emote ") then emote = string.sub(msg, 8) end if (pose == "Standing" and emoteNames[emote] ~= nil) then playAnimation(emote, 0.1, Humanoid) end end) playAnimation("idle", 0.1, Humanoid) pose = "Standing" tdelay(0, function() while c do local _, time = wait(0.1) if (script.Parent == c) and (not script.Disabled) then move(time) end end end) 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.5
  830. end
  831. if typeof(rotVelocity) ~= "Vector3" then
  832. rotVelocity = v3(20000, 20000, 20000)
  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(0, rotVelocity.Unit.Y * -1000, 0)
  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 = flingpart1
  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 = flingpart1
  892. pcall(destroy, flingpart)
  893. end
  894. end
  895. end
  896.  
  897. lp:GetMouse().Button1Down:Connect(fling) --click fling
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement