Advertisement
Lollddsf

reanim

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