lolgaming3939

Untitled

Aug 21st, 2024
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.58 KB | None | 0 0
  1. --game.Players.LocalPlayer.Character:FindFirstChild("Animate").Enabled = true
  2. --task.wait(1)
  3. local function XJGTBU_fake_script() -- ScreenGui.Animate
  4. local script = Instance.new('LocalScript', game.Players.LocalPlayer.Character)
  5. script.Name = "Anima"
  6. script.Enabled = false
  7. -- humanoidAnimatePlayEmote.lua
  8.  
  9. local Figure = script.Parent
  10. local Torso = Figure:WaitForChild("Torso")
  11. local RightShoulder = Torso:WaitForChild("Right Shoulder")
  12. local LeftShoulder = Torso:WaitForChild("Left Shoulder")
  13. local RightHip = Torso:WaitForChild("Right Hip")
  14. local LeftHip = Torso:WaitForChild("Left Hip")
  15. local Neck = Torso:WaitForChild("Neck")
  16. local Humanoid = Figure:WaitForChild("Humanoid")
  17. local pose = "Standing"
  18.  
  19. local EMOTE_TRANSITION_TIME = 0.1
  20.  
  21. local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end)
  22. local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue
  23.  
  24. local function getRigScale()
  25. if userAnimateScaleRun then
  26. return Figure:GetScale()
  27. else
  28. return 1
  29. end
  30. end
  31.  
  32. local currentAnim = ""
  33. local currentAnimInstance = nil
  34. local currentAnimTrack = nil
  35. local currentAnimKeyframeHandler = nil
  36. local currentAnimSpeed = 1.0
  37. local animTable = {}
  38. local animNames = {
  39. idle = {
  40. { id = "http://www.roblox.com/asset/?id=109014199425900", weight = 9 },
  41. { id = "http://www.roblox.com/asset/?id=109014199425900", weight = 1 }
  42. },
  43. walk = {
  44. { id = "http://www.roblox.com/asset/?id=117477404882327", weight = 10 }
  45. },
  46. run = {
  47. { id = "run.xml", weight = 10 }
  48. },
  49. jump = {
  50. { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
  51. },
  52. fall = {
  53. { id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
  54. },
  55. climb = {
  56. { id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
  57. },
  58. sit = {
  59. { id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
  60. },
  61. toolnone = {
  62. { id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
  63. },
  64. toolslash = {
  65. { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
  66. -- { id = "slash.xml", weight = 10 }
  67. },
  68. toollunge = {
  69. { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
  70. },
  71. wave = {
  72. { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
  73. },
  74. point = {
  75. { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
  76. },
  77. dance1 = {
  78. { id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
  79. { id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
  80. { id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
  81. },
  82. dance2 = {
  83. { id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
  84. { id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
  85. { id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
  86. },
  87. dance3 = {
  88. { id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
  89. { id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
  90. { id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
  91. },
  92. laugh = {
  93. { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
  94. },
  95. cheer = {
  96. { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
  97. },
  98. }
  99. local dances = {"dance1", "dance2", "dance3"}
  100.  
  101. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  102. local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
  103.  
  104. function configureAnimationSet(name, fileList)
  105. if (animTable[name] ~= nil) then
  106. for _, connection in pairs(animTable[name].connections) do
  107. connection:disconnect()
  108. end
  109. end
  110. animTable[name] = {}
  111. animTable[name].count = 0
  112. animTable[name].totalWeight = 0
  113. animTable[name].connections = {}
  114.  
  115. -- check for config values
  116. local config = script:FindFirstChild(name)
  117. if (config ~= nil) then
  118. -- print("Loading anims " .. name)
  119. table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
  120. table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
  121. local idx = 1
  122. for _, childPart in pairs(config:GetChildren()) do
  123. if (childPart:IsA("Animation")) then
  124. table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
  125. animTable[name][idx] = {}
  126. animTable[name][idx].anim = childPart
  127. local weightObject = childPart:FindFirstChild("Weight")
  128. if (weightObject == nil) then
  129. animTable[name][idx].weight = 1
  130. else
  131. animTable[name][idx].weight = weightObject.Value
  132. end
  133. animTable[name].count = animTable[name].count + 1
  134. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  135. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  136. idx = idx + 1
  137. end
  138. end
  139. end
  140.  
  141. -- fallback to defaults
  142. if (animTable[name].count <= 0) then
  143. for idx, anim in pairs(fileList) do
  144. animTable[name][idx] = {}
  145. animTable[name][idx].anim = Instance.new("Animation")
  146. animTable[name][idx].anim.Name = name
  147. animTable[name][idx].anim.AnimationId = anim.id
  148. animTable[name][idx].weight = anim.weight
  149. animTable[name].count = animTable[name].count + 1
  150. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  151. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  152. end
  153. end
  154. end
  155.  
  156. -- Setup animation objects
  157. function scriptChildModified(child)
  158. local fileList = animNames[child.Name]
  159. if (fileList ~= nil) then
  160. configureAnimationSet(child.Name, fileList)
  161. end
  162. end
  163.  
  164. script.ChildAdded:connect(scriptChildModified)
  165. script.ChildRemoved:connect(scriptChildModified)
  166.  
  167. -- Clear any existing animation tracks
  168. -- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks
  169. local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator") else nil
  170. if animator then
  171. local animTracks = animator:GetPlayingAnimationTracks()
  172. for i,track in ipairs(animTracks) do
  173. track:Stop(0)
  174. track:Destroy()
  175. end
  176. end
  177.  
  178.  
  179. for name, fileList in pairs(animNames) do
  180. configureAnimationSet(name, fileList)
  181. end
  182.  
  183. -- ANIMATION
  184.  
  185. -- declarations
  186. local toolAnim = "None"
  187. local toolAnimTime = 0
  188.  
  189. local jumpAnimTime = 0
  190. local jumpAnimDuration = 0.3
  191.  
  192. local toolTransitionTime = 0.1
  193. local fallTransitionTime = 0.3
  194. local jumpMaxLimbVelocity = 0.75
  195.  
  196. -- functions
  197.  
  198. function stopAllAnimations()
  199. local oldAnim = currentAnim
  200.  
  201. -- return to idle if finishing an emote
  202. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  203. oldAnim = "idle"
  204. end
  205.  
  206. currentAnim = ""
  207. currentAnimInstance = nil
  208. if (currentAnimKeyframeHandler ~= nil) then
  209. currentAnimKeyframeHandler:disconnect()
  210. end
  211.  
  212. if (currentAnimTrack ~= nil) then
  213. currentAnimTrack:Stop()
  214. currentAnimTrack:Destroy()
  215. currentAnimTrack = nil
  216. end
  217. return oldAnim
  218. end
  219.  
  220. function setAnimationSpeed(speed)
  221. if speed ~= currentAnimSpeed then
  222. currentAnimSpeed = speed
  223. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  224. end
  225. end
  226.  
  227. function keyFrameReachedFunc(frameName)
  228. if (frameName == "End") then
  229.  
  230. local repeatAnim = currentAnim
  231. -- return to idle if finishing an emote
  232. if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
  233. repeatAnim = "idle"
  234. end
  235.  
  236. local animSpeed = currentAnimSpeed
  237. playAnimation(repeatAnim, 0.0, Humanoid)
  238. setAnimationSpeed(animSpeed)
  239. end
  240. end
  241.  
  242. -- Preload animations
  243. function playAnimation(animName, transitionTime, humanoid)
  244.  
  245. local roll = math.random(1, animTable[animName].totalWeight)
  246. local origRoll = roll
  247. local idx = 1
  248. while (roll > animTable[animName][idx].weight) do
  249. roll = roll - animTable[animName][idx].weight
  250. idx = idx + 1
  251. end
  252. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  253. local anim = animTable[animName][idx].anim
  254.  
  255. -- switch animation
  256. if (anim ~= currentAnimInstance) then
  257.  
  258. if (currentAnimTrack ~= nil) then
  259. currentAnimTrack:Stop(transitionTime)
  260. currentAnimTrack:Destroy()
  261. end
  262.  
  263. currentAnimSpeed = 1.0
  264.  
  265. -- load it to the humanoid; get AnimationTrack
  266. currentAnimTrack = humanoid:LoadAnimation(anim)
  267. currentAnimTrack.Priority = Enum.AnimationPriority.Core
  268.  
  269. -- play the animation
  270. currentAnimTrack:Play(transitionTime)
  271. currentAnim = animName
  272. currentAnimInstance = anim
  273.  
  274. -- set up keyframe name triggers
  275. if (currentAnimKeyframeHandler ~= nil) then
  276. currentAnimKeyframeHandler:disconnect()
  277. end
  278. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  279.  
  280. end
  281.  
  282. end
  283.  
  284. -------------------------------------------------------------------------------------------
  285. -------------------------------------------------------------------------------------------
  286.  
  287. local toolAnimName = ""
  288. local toolAnimTrack = nil
  289. local toolAnimInstance = nil
  290. local currentToolAnimKeyframeHandler = nil
  291.  
  292. function toolKeyFrameReachedFunc(frameName)
  293. if (frameName == "End") then
  294. -- print("Keyframe : ".. frameName)
  295. playToolAnimation(toolAnimName, 0.0, Humanoid)
  296. end
  297. end
  298.  
  299.  
  300. function playToolAnimation(animName, transitionTime, humanoid, priority)
  301.  
  302. local roll = math.random(1, animTable[animName].totalWeight)
  303. local origRoll = roll
  304. local idx = 1
  305. while (roll > animTable[animName][idx].weight) do
  306. roll = roll - animTable[animName][idx].weight
  307. idx = idx + 1
  308. end
  309. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  310. local anim = animTable[animName][idx].anim
  311.  
  312. if (toolAnimInstance ~= anim) then
  313.  
  314. if (toolAnimTrack ~= nil) then
  315. toolAnimTrack:Stop()
  316. toolAnimTrack:Destroy()
  317. transitionTime = 0
  318. end
  319.  
  320. -- load it to the humanoid; get AnimationTrack
  321. toolAnimTrack = humanoid:LoadAnimation(anim)
  322. if priority then
  323. toolAnimTrack.Priority = priority
  324. end
  325.  
  326. -- play the animation
  327. toolAnimTrack:Play(transitionTime)
  328. toolAnimName = animName
  329. toolAnimInstance = anim
  330.  
  331. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  332. end
  333. end
  334.  
  335. function stopToolAnimations()
  336. local oldAnim = toolAnimName
  337.  
  338. if (currentToolAnimKeyframeHandler ~= nil) then
  339. currentToolAnimKeyframeHandler:disconnect()
  340. end
  341.  
  342. toolAnimName = ""
  343. toolAnimInstance = nil
  344. if (toolAnimTrack ~= nil) then
  345. toolAnimTrack:Stop()
  346. toolAnimTrack:Destroy()
  347. toolAnimTrack = nil
  348. end
  349.  
  350.  
  351. return oldAnim
  352. end
  353.  
  354. -------------------------------------------------------------------------------------------
  355. -------------------------------------------------------------------------------------------
  356.  
  357.  
  358. function onRunning(speed)
  359. speed /= getRigScale()
  360.  
  361. if speed > 0.01 then
  362. playAnimation("walk", 0.1, Humanoid)
  363. if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
  364. setAnimationSpeed(speed / 14.5)
  365. end
  366. pose = "Running"
  367. else
  368. if emoteNames[currentAnim] == nil then
  369. playAnimation("idle", 0.1, Humanoid)
  370. pose = "Standing"
  371. end
  372. end
  373. end
  374.  
  375. function onDied()
  376. pose = "Dead"
  377. end
  378.  
  379. function onJumping()
  380. playAnimation("jump", 0.1, Humanoid)
  381. jumpAnimTime = jumpAnimDuration
  382. pose = "Jumping"
  383. end
  384.  
  385. function onClimbing(speed)
  386. speed /= getRigScale()
  387.  
  388. playAnimation("climb", 0.1, Humanoid)
  389. setAnimationSpeed(speed / 12.0)
  390. pose = "Climbing"
  391. end
  392.  
  393. function onGettingUp()
  394. pose = "GettingUp"
  395. end
  396.  
  397. function onFreeFall()
  398. if (jumpAnimTime <= 0) then
  399. playAnimation("fall", fallTransitionTime, Humanoid)
  400. end
  401. pose = "FreeFall"
  402. end
  403.  
  404. function onFallingDown()
  405. pose = "FallingDown"
  406. end
  407.  
  408. function onSeated()
  409. pose = "Seated"
  410. end
  411.  
  412. function onPlatformStanding()
  413. pose = "PlatformStanding"
  414. end
  415.  
  416. function onSwimming(speed)
  417. if speed > 0 then
  418. pose = "Running"
  419. else
  420. pose = "Standing"
  421. end
  422. end
  423.  
  424. function getTool()
  425. for _, kid in ipairs(Figure:GetChildren()) do
  426. if kid.className == "Tool" then return kid end
  427. end
  428. return nil
  429. end
  430.  
  431. function getToolAnim(tool)
  432. for _, c in ipairs(tool:GetChildren()) do
  433. if c.Name == "toolanim" and c.className == "StringValue" then
  434. return c
  435. end
  436. end
  437. return nil
  438. end
  439.  
  440. function animateTool()
  441.  
  442. if (toolAnim == "None") then
  443. playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
  444. return
  445. end
  446.  
  447. if (toolAnim == "Slash") then
  448. playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
  449. return
  450. end
  451.  
  452. if (toolAnim == "Lunge") then
  453. playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
  454. return
  455. end
  456. end
  457.  
  458. function moveSit()
  459. RightShoulder.MaxVelocity = 0.15
  460. LeftShoulder.MaxVelocity = 0.15
  461. RightShoulder:SetDesiredAngle(3.14 /2)
  462. LeftShoulder:SetDesiredAngle(-3.14 /2)
  463. RightHip:SetDesiredAngle(3.14 /2)
  464. LeftHip:SetDesiredAngle(-3.14 /2)
  465. end
  466.  
  467. local lastTick = 0
  468.  
  469. function move(time)
  470. local amplitude = 1
  471. local frequency = 1
  472. local deltaTime = time - lastTick
  473. lastTick = time
  474.  
  475. local climbFudge = 0
  476. local setAngles = false
  477.  
  478. if (jumpAnimTime > 0) then
  479. jumpAnimTime = jumpAnimTime - deltaTime
  480. end
  481.  
  482. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  483. playAnimation("fall", fallTransitionTime, Humanoid)
  484. elseif (pose == "Seated") then
  485. playAnimation("sit", 0.5, Humanoid)
  486. return
  487. elseif (pose == "Running") then
  488. playAnimation("walk", 0.1, Humanoid)
  489. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  490. -- print("Wha " .. pose)
  491. stopAllAnimations()
  492. amplitude = 0.1
  493. frequency = 1
  494. setAngles = true
  495. end
  496.  
  497. if (setAngles) then
  498. local desiredAngle = amplitude * math.sin(time * frequency)
  499.  
  500. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  501. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  502. RightHip:SetDesiredAngle(-desiredAngle)
  503. LeftHip:SetDesiredAngle(-desiredAngle)
  504. end
  505.  
  506. -- Tool Animation handling
  507. local tool = getTool()
  508. if tool and tool:FindFirstChild("Handle") then
  509.  
  510. local animStringValueObject = getToolAnim(tool)
  511.  
  512. if animStringValueObject then
  513. toolAnim = animStringValueObject.Value
  514. -- message recieved, delete StringValue
  515. animStringValueObject.Parent = nil
  516. toolAnimTime = time + .3
  517. end
  518.  
  519. if time > toolAnimTime then
  520. toolAnimTime = 0
  521. toolAnim = "None"
  522. end
  523.  
  524. animateTool()
  525. else
  526. stopToolAnimations()
  527. toolAnim = "None"
  528. toolAnimInstance = nil
  529. toolAnimTime = 0
  530. end
  531. end
  532.  
  533. -- connect events
  534. Humanoid.Died:connect(onDied)
  535. Humanoid.Running:connect(onRunning)
  536. Humanoid.Jumping:connect(onJumping)
  537. Humanoid.Climbing:connect(onClimbing)
  538. Humanoid.GettingUp:connect(onGettingUp)
  539. Humanoid.FreeFalling:connect(onFreeFall)
  540. Humanoid.FallingDown:connect(onFallingDown)
  541. Humanoid.Seated:connect(onSeated)
  542. Humanoid.PlatformStanding:connect(onPlatformStanding)
  543. Humanoid.Swimming:connect(onSwimming)
  544.  
  545. ---- setup emote chat hook
  546. game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)
  547. local emote = ""
  548. if msg == "/e dance" then
  549. emote = dances[math.random(1, #dances)]
  550. elseif (string.sub(msg, 1, 3) == "/e ") then
  551. emote = string.sub(msg, 4)
  552. elseif (string.sub(msg, 1, 7) == "/emote ") then
  553. emote = string.sub(msg, 8)
  554. end
  555.  
  556. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  557. playAnimation(emote, 0.1, Humanoid)
  558. end
  559.  
  560. end)
  561.  
  562. -- emote bindable hook
  563. script:WaitForChild("PlayEmote").OnInvoke = function(emote)
  564. -- Only play emotes when idling
  565. if pose ~= "Standing" then
  566. return
  567. end
  568. if emoteNames[emote] ~= nil then
  569. -- Default emotes
  570. playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
  571.  
  572. return true, currentAnimTrack
  573. end
  574.  
  575. -- Return false to indicate that the emote could not be played
  576. return false
  577. end
  578. -- main program
  579.  
  580. -- initialize to idle
  581. playAnimation("idle", 0.1, Humanoid)
  582. pose = "Standing"
  583.  
  584. while Figure.Parent ~= nil do
  585. local _, time = wait(0.1)
  586. move(time)
  587. end
  588.  
  589.  
  590.  
  591. end
  592. local function XTGTBU_fake_script()
  593. local script = Instance.new('LocalScript', game.Players.LocalPlayer.Character)
  594. script.Name = "Dash"
  595. local UIS = game:GetService("UserInputService")
  596. local char = script.Parent
  597.  
  598. local slideAnim = Instance.new("Animation")
  599. slideAnim.AnimationId = "rbxassetid://82560487135901" -- Enter your AnimtionID
  600.  
  601. local keybind = Enum.KeyCode.Q -- between the key for ability
  602. local canslide = true
  603.  
  604. UIS.InputBegan:Connect(function(input,gameprocessed)
  605. if gameprocessed then return end
  606. if not canslide then return end
  607.  
  608. if input.KeyCode == keybind then
  609. canslide = false
  610.  
  611. local playAnim = char.Humanoid:LoadAnimation(slideAnim)
  612. playAnim:Play()
  613.  
  614. local slide = Instance.new("BodyVelocity")
  615. slide.MaxForce = Vector3.new(1,0,1) * 30000
  616. slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100
  617. slide.Parent = char.HumanoidRootPart
  618.  
  619. for count = 1, 8 do
  620. wait(0.1)
  621. slide.Velocity*= 0.7
  622. end
  623. playAnim:Stop()
  624. slide:Destroy()
  625. canslide = true
  626. end
  627. end)
  628. end
  629. coroutine.wrap(XTGTBU_fake_script)()
  630. coroutine.wrap(XJGTBU_fake_script)()
  631.  
Advertisement
Add Comment
Please, Sign In to add comment