Advertisement
metilol

rt

Mar 31st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --hi
  2. Player = game:GetService("Players").LocalPlayer
  3. PlayerGui = Player.PlayerGui
  4. Cam = workspace.CurrentCamera
  5. Backpack = Player.Backpack
  6. Character = Player.Character
  7. Humanoid = Character.Humanoid
  8. Mouse = Player:GetMouse()
  9. RootPart = Character["HumanoidRootPart"]
  10. Torso = Character["Torso"]
  11. Head = Character["Head"]
  12. RightArm = Character["Right Arm"]
  13. LeftArm = Character["Left Arm"]
  14. RightLeg = Character["Right Leg"]
  15. LeftLeg = Character["Left Leg"]
  16. RootJoint = RootPart["RootJoint"]
  17. Neck = Torso["Neck"]
  18. RightShoulder = Torso["Right Shoulder"]
  19. LeftShoulder = Torso["Left Shoulder"]
  20. RightHip = Torso["Right Hip"]
  21. LeftHip = Torso["Left Hip"]
  22. local sick = Instance.new("Sound",Character)
  23. sick.SoundId = "rbxassetid://531711813"
  24. sick.Looped = true
  25. sick.Pitch = 1
  26. sick.Volume = 1
  27. Head:ClearAllChildren()
  28.  
  29. local tor = Instance.new("CharacterMesh")
  30. tor.Parent = Character
  31. tor.Name = "Bones"
  32. tor.BodyPart = "Torso"
  33. tor.MeshId = "42587319"
  34. tor.OverlayTextureId = "42587579"
  35.  
  36. local tor = Instance.new("CharacterMesh")
  37. tor.Parent = Character
  38. tor.Name = "Bones"
  39. tor.BodyPart = "LeftLeg"
  40. tor.MeshId = "42587271"
  41. tor.OverlayTextureId = "42587579"
  42.  
  43. local tor = Instance.new("CharacterMesh")
  44. tor.Parent = Character
  45. tor.Name = "Bones"
  46. tor.BodyPart = "RightLeg"
  47. tor.MeshId = "42587421"
  48. tor.OverlayTextureId = "42587579"
  49.  
  50. local tor = Instance.new("CharacterMesh")
  51. tor.Parent = Character
  52. tor.Name = "Bones"
  53. tor.BodyPart = "RightArm"
  54. tor.MeshId = "42587369"
  55. tor.OverlayTextureId = "42587579"
  56.  
  57. local tor = Instance.new("CharacterMesh")
  58. tor.Parent = Character
  59. tor.Name = "Bones"
  60. tor.BodyPart = "LeftArm"
  61. tor.MeshId = "42587103"
  62. tor.OverlayTextureId = "42587579"
  63.  
  64. local tor = Instance.new("SpecialMesh")
  65. tor.Scale = Vector3.new(1,1,1)
  66. tor.MeshType = "FileMesh"
  67. tor.MeshId = "http://www.roblox.com/asset/?id=41752768"
  68. tor.TextureId = "rbxassetid://41752747"
  69. tor.Parent = Head
  70.  
  71. function onChatted(msg, recipient, speaker)
  72.  
  73.  
  74.  
  75. local source = string.lower(speaker.Name)
  76.  
  77.  
  78. if (string.sub(msg,1,5) == "name/") then
  79. speaker.CharacterAppearance = "http://www.roblox.com/user.aspx?id="..string.sub(msg,5)
  80. speaker.Character:BreakJoints()
  81. end
  82.  
  83.  
  84.  
  85. end
  86.  
  87. function onPlayerEntered(newPlayer)
  88. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  89. end
  90.  
  91. game.Players.ChildAdded:connect(onPlayerEntered)
  92.  
  93. local Animate4 = game:GetService("Players").LocalPlayer.Character:WaitForChild("Animate")
  94. Animate4:Destroy()
  95. script.Parent = game:GetService("Players").LocalPlayer
  96.  
  97. function waitForChild(parent, childName)
  98. local child = parent:findFirstChild(childName)
  99. if child then return child end
  100. while true do
  101. child = parent.ChildAdded:wait()
  102. if child.Name==childName then return child end
  103. end
  104. end
  105.  
  106. -- ANIMATION
  107.  
  108. -- declarations
  109.  
  110. local Figure = workspace:WaitForChild(game:GetService("Players").LocalPlayer.Name)
  111. if Figure then
  112. print("You became a dummy!")
  113. end
  114. local Torso = waitForChild(Figure, "Torso")
  115. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  116. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  117. local RightHip = waitForChild(Torso, "Right Hip")
  118. local LeftHip = waitForChild(Torso, "Left Hip")
  119. local Neck = waitForChild(Torso, "Neck")
  120. local Humanoid = Figure:FindFirstChildOfClass("Humanoid")
  121. local pose = "Standing"
  122.  
  123. local toolAnim = "None"
  124. local toolAnimTime = 0
  125.  
  126. local jumpMaxLimbVelocity = 0.75
  127.  
  128. -- functions
  129.  
  130. function onRunning(speed)
  131. if speed>0 then
  132. pose = "Running"
  133. else
  134. pose = "Standing"
  135. end
  136. end
  137.  
  138. function onDied()
  139. pose = "Dead"
  140. end
  141.  
  142. function onJumping()
  143. pose = "Jumping"
  144. end
  145.  
  146. function onClimbing()
  147. pose = "Climbing"
  148. end
  149.  
  150. function onGettingUp()
  151. pose = "GettingUp"
  152. end
  153.  
  154. function onFreeFall()
  155. pose = "FreeFall"
  156. end
  157.  
  158. function onFallingDown()
  159. pose = "FallingDown"
  160. end
  161.  
  162. function onSeated()
  163. pose = "Seated"
  164. end
  165.  
  166. function onPlatformStanding()
  167. pose = "PlatformStanding"
  168. end
  169.  
  170. function onSwimming(speed)
  171. if speed>0 then
  172. pose = "Running"
  173. else
  174. pose = "Standing"
  175. end
  176. end
  177.  
  178. function moveJump()
  179. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  180. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  181. RightShoulder:SetDesiredAngle(3.14)
  182. LeftShoulder:SetDesiredAngle(-3.14)
  183. RightHip:SetDesiredAngle(0)
  184. LeftHip:SetDesiredAngle(0)
  185. end
  186.  
  187.  
  188. -- same as jump for now
  189.  
  190. function moveFreeFall()
  191. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  192. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  193. RightShoulder:SetDesiredAngle(3.14)
  194. LeftShoulder:SetDesiredAngle(-3.14)
  195. RightHip:SetDesiredAngle(0)
  196. LeftHip:SetDesiredAngle(0)
  197. end
  198.  
  199. function moveSit()
  200. RightShoulder.MaxVelocity = 0.15
  201. LeftShoulder.MaxVelocity = 0.15
  202. RightShoulder:SetDesiredAngle(3.14 /2)
  203. LeftShoulder:SetDesiredAngle(-3.14 /2)
  204. RightHip:SetDesiredAngle(3.14 /2)
  205. LeftHip:SetDesiredAngle(-3.14 /2)
  206. end
  207.  
  208. function getTool()
  209. for _, kid in ipairs(Figure:GetChildren()) do
  210. if kid.className == "Tool" then return kid end
  211. end
  212. return nil
  213. end
  214.  
  215. function getToolAnim(tool)
  216. for _, c in ipairs(tool:GetChildren()) do
  217. if c.Name == "toolanim" and c.className == "StringValue" then
  218. return c
  219. end
  220. end
  221. return nil
  222. end
  223.  
  224. function animateTool()
  225.  
  226. if (toolAnim == "None") then
  227. RightShoulder:SetDesiredAngle(1.57)
  228. return
  229. end
  230.  
  231. if (toolAnim == "Slash") then
  232. RightShoulder.MaxVelocity = 0.5
  233. RightShoulder:SetDesiredAngle(0)
  234. return
  235. end
  236.  
  237. if (toolAnim == "Lunge") then
  238. RightShoulder.MaxVelocity = 0.5
  239. LeftShoulder.MaxVelocity = 0.5
  240. RightHip.MaxVelocity = 0.5
  241. LeftHip.MaxVelocity = 0.5
  242. RightShoulder:SetDesiredAngle(1.57)
  243. LeftShoulder:SetDesiredAngle(1.0)
  244. RightHip:SetDesiredAngle(1.57)
  245. LeftHip:SetDesiredAngle(1.0)
  246. return
  247. end
  248. end
  249.  
  250. function move(time)
  251. local amplitude
  252. local frequency
  253.  
  254. if (pose == "Jumping") then
  255. moveJump()
  256. return
  257. end
  258.  
  259. if (pose == "FreeFall") then
  260. moveFreeFall()
  261. return
  262. end
  263.  
  264. if (pose == "Seated") then
  265. moveSit()
  266. return
  267. end
  268.  
  269. local climbFudge = 0
  270.  
  271. if (pose == "Running") then
  272. if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
  273. RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  274. else
  275. RightShoulder.MaxVelocity = 0.15
  276. end
  277. if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
  278. LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  279. else
  280. LeftShoulder.MaxVelocity = 0.15
  281. end
  282. amplitude = 1
  283. frequency = 9
  284. elseif (pose == "Climbing") then
  285. RightShoulder.MaxVelocity = 0.5
  286. LeftShoulder.MaxVelocity = 0.5
  287. amplitude = 1
  288. frequency = 9
  289. climbFudge = 3.14
  290. else
  291. amplitude = 0.1
  292. frequency = 1
  293. end
  294.  
  295. desiredAngle = amplitude * math.sin(time*frequency)
  296.  
  297. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  298. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  299. RightHip:SetDesiredAngle(-desiredAngle)
  300. LeftHip:SetDesiredAngle(-desiredAngle)
  301.  
  302.  
  303. local tool = getTool()
  304.  
  305. if tool then
  306.  
  307. animStringValueObject = getToolAnim(tool)
  308.  
  309. if animStringValueObject then
  310. toolAnim = animStringValueObject.Value
  311. -- message recieved, delete StringValue
  312. animStringValueObject.Parent = nil
  313. toolAnimTime = time + .3
  314. end
  315.  
  316. if time > toolAnimTime then
  317. toolAnimTime = 0
  318. toolAnim = "None"
  319. end
  320.  
  321. animateTool()
  322.  
  323.  
  324. else
  325. toolAnim = "None"
  326. toolAnimTime = 0
  327. end
  328. end
  329.  
  330.  
  331. -- connect events
  332.  
  333. Humanoid.Died:connect(onDied)
  334. Humanoid.Running:connect(onRunning)
  335. Humanoid.Jumping:connect(onJumping)
  336. Humanoid.Climbing:connect(onClimbing)
  337. Humanoid.GettingUp:connect(onGettingUp)
  338. Humanoid.FreeFalling:connect(onFreeFall)
  339. Humanoid.FallingDown:connect(onFallingDown)
  340. Humanoid.Seated:connect(onSeated)
  341. Humanoid.PlatformStanding:connect(onPlatformStanding)
  342. Humanoid.Swimming:connect(onSwimming)
  343. -- main program
  344.  
  345. local runService = game:service("RunService");
  346.  
  347. game:GetService("Players").LocalPlayer.CharacterAdded:connect(function()
  348. print("Respawning with old anims")
  349. Figure = game:GetService("Players").LocalPlayer.Character
  350. Animate4 = Figure:WaitForChild("Animate")
  351. Animate4:Destroy()
  352. Humanoid = Figure:FindFirstChildOfClass("Humanoid")
  353. Torso = waitForChild(Figure, "Torso")
  354. RightShoulder = waitForChild(Torso, "Right Shoulder")
  355. LeftShoulder = waitForChild(Torso, "Left Shoulder")
  356. RightHip = waitForChild(Torso, "Right Hip")
  357. LeftHip = waitForChild(Torso, "Left Hip")
  358. Neck = waitForChild(Torso, "Neck")
  359. end)
  360.  
  361. while Figure.Parent~=nil do
  362. local _, time = wait(0.1)
  363. move(time)
  364. end
  365. --bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement