Advertisement
Lollddsf

rera

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