Advertisement
MeowyMeowth

FE old animation (Not mine)

Nov 9th, 2024
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. --- Made by Anonymous
  2.  
  3. local Players = game:GetService("Players")
  4. local LocalPlayer = Players.LocalPlayer
  5. local Char2 = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  6. local h = Char2:FindFirstChildOfClass("Humanoid") or Char2:WaitForChild("Humanoid")
  7.  
  8. if h.RigType ~= Enum.HumanoidRigType.R6 then return end
  9.  
  10. LocalPlayer.Character:BreakJoints()
  11. LocalPlayer.Character=nil
  12. repeat task.wait() until LocalPlayer.Character
  13. Char = LocalPlayer.Character
  14. task.wait(.1)
  15. LocalPlayer.Character:BreakJoints()
  16.  
  17. LocalPlayer.CharacterAdded:Connect(function(c)
  18. Char = c
  19. function waitForChild(parent, childName)
  20. local child = parent:FindFirstChild(childName)
  21. if child then return child end
  22. while true do
  23. child = parent.ChildAdded:Wait()
  24. if child.Name == childName then return child end
  25. end
  26. end
  27.  
  28. waitForChild(Char, "Animate").Disabled = true
  29.  
  30. task.wait(1)
  31.  
  32. -- ANIMATION
  33.  
  34. -- declarations
  35.  
  36. local Players = game:GetService("Players")
  37. local LocalPlayer = Players.LocalPlayer
  38. local Figure = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  39. local Torso = waitForChild(Figure, "Torso")
  40. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  41. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  42. local RightHip = waitForChild(Torso, "Right Hip")
  43. local LeftHip = waitForChild(Torso, "Left Hip")
  44. local Neck = waitForChild(Torso, "Neck")
  45. local Humanoid = waitForChild(Figure, "Humanoid")
  46. local pose = "Standing"
  47.  
  48. local toolAnim = "None"
  49. local toolAnimTime = 0
  50.  
  51. local jumpMaxLimbVelocity = 0.75
  52.  
  53. -- functions
  54.  
  55. function onRunning(speed)
  56. if speed>0 then
  57. pose = "Running"
  58. else
  59. pose = "Standing"
  60. end
  61. end
  62.  
  63. function onDied()
  64. pose = "Dead"
  65. end
  66.  
  67. function onJumping()
  68. pose = "Jumping"
  69. end
  70.  
  71. function onClimbing()
  72. pose = "Climbing"
  73. end
  74.  
  75. function onGettingUp()
  76. pose = "GettingUp"
  77. end
  78.  
  79. function onFreeFall()
  80. pose = "FreeFall"
  81. end
  82.  
  83. function onFallingDown()
  84. pose = "FallingDown"
  85. end
  86.  
  87. function onSeated()
  88. pose = "Seated"
  89. end
  90.  
  91. function onPlatformStanding()
  92. pose = "PlatformStanding"
  93. end
  94.  
  95. function onSwimming(speed)
  96. if speed>0 then
  97. pose = "Climbing"
  98. else
  99. pose = "Running"
  100. end
  101. end
  102.  
  103. function moveJump()
  104. RightShoulder.MaxVelocity = 0.5
  105. LeftShoulder.MaxVelocity = 0.5
  106. RightShoulder:SetDesiredAngle(3.14)
  107. LeftShoulder:SetDesiredAngle(-3.14)
  108. RightHip:SetDesiredAngle(0)
  109. LeftHip:SetDesiredAngle(0)
  110. end
  111.  
  112.  
  113. -- same as jump for now
  114.  
  115. function moveFreeFall()
  116. RightShoulder.MaxVelocity = 0.5
  117. LeftShoulder.MaxVelocity = 0.5
  118. RightShoulder:SetDesiredAngle(3.14)
  119. LeftShoulder:SetDesiredAngle(-3.14)
  120. RightHip:SetDesiredAngle(0)
  121. LeftHip:SetDesiredAngle(0)
  122. end
  123.  
  124. function moveSit()
  125. RightShoulder.MaxVelocity = 0.5
  126. LeftShoulder.MaxVelocity = 0.5
  127. RightShoulder:SetDesiredAngle(3.14 /2)
  128. LeftShoulder:SetDesiredAngle(-3.14 /2)
  129. RightHip:SetDesiredAngle(3.14 /2)
  130. LeftHip:SetDesiredAngle(-3.14 /2)
  131. end
  132.  
  133. function getTool()
  134. for _, kid in ipairs(Figure:GetChildren()) do
  135. if kid.className == "Tool" then return kid end
  136. end
  137. return nil
  138. end
  139.  
  140. function getToolAnim(tool)
  141. for _, c in ipairs(tool:GetChildren()) do
  142. if c.Name == "toolanim" and c.className == "StringValue" then
  143. return c
  144. end
  145. end
  146. return nil
  147. end
  148.  
  149. function animateTool()
  150.  
  151. if (toolAnim == "None") then
  152. RightShoulder:SetDesiredAngle(1.57)
  153. return
  154. end
  155.  
  156. if (toolAnim == "Slash") then
  157. RightShoulder.MaxVelocity = 0.5
  158. RightShoulder:SetDesiredAngle(0)
  159. return
  160. end
  161.  
  162. if (toolAnim == "Lunge") then
  163. RightShoulder.MaxVelocity = 0.5
  164. LeftShoulder.MaxVelocity = 0.5
  165. RightHip.MaxVelocity = 0.5
  166. LeftHip.MaxVelocity = 0.5
  167. RightShoulder:SetDesiredAngle(1.57)
  168. LeftShoulder:SetDesiredAngle(1.0)
  169. RightHip:SetDesiredAngle(1.57)
  170. LeftHip:SetDesiredAngle(1.0)
  171. return
  172. end
  173. end
  174.  
  175. function move(time)
  176. local amplitude
  177. local frequency
  178.  
  179. if (pose == "Jumping") then
  180. moveJump()
  181. return
  182. end
  183.  
  184. if (pose == "FreeFall") then
  185. moveFreeFall()
  186. return
  187. end
  188.  
  189. if (pose == "Seated") then
  190. moveSit()
  191. return
  192. end
  193.  
  194. local climbFudge = 0
  195.  
  196. if (pose == "Running") then
  197. RightShoulder.MaxVelocity = 0.08
  198. LeftShoulder.MaxVelocity = 0.08
  199. amplitude = 0.66
  200. frequency = 8
  201. elseif (pose == "Climbing") then
  202. RightShoulder.MaxVelocity = 0.4
  203. LeftShoulder.MaxVelocity = 0.4
  204. amplitude = 0.66
  205. frequency = 9
  206. climbFudge = 3.14
  207. else
  208. amplitude = 0.07
  209. frequency = 1
  210. end
  211.  
  212. desiredAngle = amplitude * math.sin(time*frequency)
  213.  
  214. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  215. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  216. RightHip:SetDesiredAngle(-desiredAngle)
  217. LeftHip:SetDesiredAngle(-desiredAngle)
  218.  
  219.  
  220. local tool = getTool()
  221.  
  222. if tool then
  223.  
  224. animStringValueObject = getToolAnim(tool)
  225.  
  226. if animStringValueObject then
  227. toolAnim = animStringValueObject.Value
  228. -- message recieved, delete StringValue
  229. animStringValueObject.Parent = nil
  230. toolAnimTime = time + .3
  231. end
  232.  
  233. if time > toolAnimTime then
  234. toolAnimTime = 0
  235. toolAnim = "None"
  236. end
  237.  
  238. animateTool()
  239.  
  240. else
  241. toolAnim = "None"
  242. toolAnimTime = 0
  243. end
  244. end
  245.  
  246.  
  247. -- connect events
  248.  
  249. Humanoid.Died:Connect(onDied)
  250. Humanoid.Running:Connect(onRunning)
  251. Humanoid.Jumping:Connect(onJumping)
  252. Humanoid.Climbing:Connect(onClimbing)
  253. Humanoid.GettingUp:Connect(onGettingUp)
  254. Humanoid.FreeFalling:Connect(onFreeFall)
  255. Humanoid.FallingDown:Connect(onFallingDown)
  256. Humanoid.Seated:Connect(onSeated)
  257. Humanoid.PlatformStanding:Connect(onPlatformStanding)
  258. Humanoid.Swimming:Connect(onSwimming)
  259. -- main program
  260.  
  261. local runService = game:service("RunService");
  262.  
  263. while Figure.Parent~=nil do
  264. local _, time = wait(0.1)
  265. move(time)
  266. end
  267. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement