Advertisement
Dark_EccentricYT

Untitled

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