Advertisement
HenloMyDude

old rooblex but you

Oct 2nd, 2019
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. function waitForChild(parent, childName)
  2. local child = parent:findFirstChild(childName)
  3. if child then return child end
  4. while true do
  5. child = parent.ChildAdded:wait()
  6. if child.Name==childName then return child end
  7. end
  8. end
  9.  
  10. local pos = Instance.new("Part",workspace)
  11. pos.Anchored = true
  12. pos.Position = owner.Character.Torso.Position
  13. pos.CanCollide = false
  14. owner:LoadCharacter()
  15. owner.Character.Humanoid.Animator:Destroy()
  16. owner.Character.Torso.CFrame = pos.CFrame
  17. pos:Destroy()
  18.  
  19. char = owner.Character
  20. if char:FindFirstChild("Head") then
  21. if char.Head:FindFirstChild("face") ~= nil then
  22. face = char.Head:FindFirstChild("face")
  23. face.Texture = "rbxassetid://3248568733"
  24. face.Parent.Mesh.MeshType = "FileMesh"
  25. face.Parent.Mesh.MeshId = "rbxassetid://1068249467"
  26. end
  27. for i,v in pairs(char:GetChildren()) do
  28. if v.ClassName == "Shirt" or v.ClassName == "Pants" or v.ClassName == "Accessory" or v.ClassName == "CharacterMesh" or v.ClassName == "Shirt Graphic" then
  29. end
  30. if v.ClassName == "BodyColors" then
  31. local Shirt = Instance.new("Shirt",face.Parent.Parent)
  32. local TorsMesh = Instance.new("CharacterMesh", face.Parent.Parent)
  33. TorsMesh.BodyPart = "Torso"
  34. TorsMesh.MeshId = 1112228624
  35. local RAMesh = Instance.new("CharacterMesh", face.Parent.Parent)
  36. RAMesh.BodyPart = "RightArm"
  37. RAMesh.MeshId = 1112244824
  38. local LAMesh = Instance.new("CharacterMesh", face.Parent.Parent)
  39. LAMesh.BodyPart = "LeftArm"
  40. LAMesh.MeshId = 1112256772
  41. local RLMesh = Instance.new("CharacterMesh", face.Parent.Parent)
  42. RLMesh.BodyPart = "RightLeg"
  43. RLMesh.MeshId = 1112267576
  44. local LLMesh = Instance.new("CharacterMesh", face.Parent.Parent)
  45. LLMesh.BodyPart = "LeftLeg"
  46. LLMesh.MeshId = 1112275294
  47. end
  48. end
  49. end
  50.  
  51. local Figure = owner.Character
  52. local Torso = waitForChild(Figure, "Torso")
  53. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  54. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  55. local RightHip = waitForChild(Torso, "Right Hip")
  56. local LeftHip = waitForChild(Torso, "Left Hip")
  57. local Neck = waitForChild(Torso, "Neck")
  58. local Humanoid = waitForChild(Figure, "Humanoid")
  59.  
  60. for _,v in pairs (Figure:children()) do
  61. if v:IsA("Part") then v.CanCollide = true end
  62. end
  63.  
  64. function onRunning(speed)
  65. if speed>0 then
  66. pose = "Running"
  67. else
  68. pose = "Standing"
  69. end
  70. end
  71.  
  72. function onDied()
  73. pose = "Dead"
  74. Humanoid.AutoRotate = true
  75. end
  76.  
  77. function onJumping()
  78. pose = "Jumping"
  79. Humanoid.AutoRotate = false
  80. end
  81.  
  82. function onClimbing()
  83. pose = "Climbing"
  84. end
  85.  
  86. function onGettingUp()
  87. pose = "GettingUp"
  88. Humanoid.AutoRotate = true
  89. end
  90.  
  91. function onFreeFall()
  92. pose = "FreeFall"
  93. Humanoid.AutoRotate = false
  94. end
  95.  
  96. function onFallingDown()
  97. pose = "FallingDown"
  98. Humanoid.AutoRotate = true
  99. end
  100.  
  101. function onSeated()
  102. pose = "Seated"
  103. Humanoid.AutoRotate = true
  104. end
  105.  
  106. function onPlatformStanding()
  107. pose = "PlatformStanding"
  108. Humanoid.AutoRotate = true
  109. end
  110.  
  111. function moveJump()
  112. RightShoulder.MaxVelocity = 0.5
  113. LeftShoulder.MaxVelocity = 0.5
  114. RightShoulder.DesiredAngle = 3.14
  115. LeftShoulder.DesiredAngle = -3.14
  116. RightHip.DesiredAngle = 0
  117. LeftHip.DesiredAngle = 0
  118. Humanoid.AutoRotate = false
  119. end
  120.  
  121.  
  122. -- same as jump for now
  123.  
  124. function moveFreeFall()
  125. RightShoulder.MaxVelocity = 0.5
  126. LeftShoulder.MaxVelocity = 0.5
  127. RightShoulder.DesiredAngle = 3.14
  128. LeftShoulder.DesiredAngle = -3.14
  129. RightHip.DesiredAngle = 0
  130. LeftHip.DesiredAngle = 0
  131. Humanoid.AutoRotate = false
  132. end
  133.  
  134. function moveSit()
  135. RightShoulder.MaxVelocity = 0.1
  136. LeftShoulder.MaxVelocity = 0.1
  137. RightShoulder.DesiredAngle = 3.14/2
  138. LeftShoulder.DesiredAngle = -3.14/2
  139. RightHip.DesiredAngle = 3.14/2
  140. LeftHip.DesiredAngle = -3.14/2
  141. Humanoid.AutoRotate = true
  142. end
  143.  
  144. function getTool()
  145. for _, kid in ipairs(Figure:GetChildren()) do
  146. if kid.className == "Tool" then return kid end
  147. end
  148. return nil
  149. end
  150.  
  151. function getToolAnim(tool)
  152. for _, c in ipairs(tool:GetChildren()) do
  153. if c.Name == "toolanim" and c.className == "StringValue" then
  154. return c
  155. end
  156. end
  157. return nil
  158. end
  159.  
  160. function animateTool()
  161.  
  162. if (toolAnim == "None") then
  163. RightShoulderdDesiredAngle = 1.57
  164. return
  165. end
  166.  
  167. if (toolAnim == "Slash") then
  168. RightShoulder.MaxVelocity = 0.5
  169. RightShoulder.DesiredAngle = 0
  170. return
  171. end
  172.  
  173. if (toolAnim == "Lunge") then
  174. RightShoulder.MaxVelocity = 0.5
  175. LeftShoulder.MaxVelocity = 0.5
  176. RightHip.MaxVelocity = 0.5
  177. LeftHip.MaxVelocity = 0.5
  178. RightShoulder.DesiredAngle = 1.57
  179. LeftShoulder.DesiredAngle = 0
  180. RightHip.DesiredAngle = 1.57
  181. LeftHip.DesiredAngle = 1.0
  182. return
  183. end
  184. end
  185.  
  186. function move(time)
  187. local amplitude
  188. local frequency
  189.  
  190. if (pose == "Jumping") then
  191. moveJump()
  192. return
  193. end
  194.  
  195. if (pose == "FreeFall") then
  196. moveFreeFall()
  197. return
  198. end
  199.  
  200. if (pose == "Seated") then
  201. moveSit()
  202. return
  203. end
  204.  
  205. local climbFudge = 0
  206.  
  207. if (pose == "Running") then
  208. RightShoulder.MaxVelocity = 0.15
  209. LeftShoulder.MaxVelocity = 0.15
  210. amplitude = 1
  211. frequency = 9
  212. Humanoid.AutoRotate = true
  213. elseif (pose == "Climbing") then
  214. RightShoulder.MaxVelocity = 0.5
  215. LeftShoulder.MaxVelocity = 0.5
  216. amplitude = 1
  217. frequency = 9
  218. climbFudge = 3.14
  219. Humanoid.AutoRotate = true
  220. else
  221. amplitude = 0.1
  222. frequency = 1
  223. Humanoid.AutoRotate = true
  224. end
  225.  
  226. desiredAngle = amplitude * math.sin(time*frequency)
  227.  
  228. RightShoulder.DesiredAngle = desiredAngle + climbFudge
  229. LeftShoulder.DesiredAngle = desiredAngle - climbFudge
  230. RightHip.DesiredAngle = -desiredAngle
  231. LeftHip.DesiredAngle = -desiredAngle
  232.  
  233. local tool = getTool()
  234.  
  235. if tool then
  236.  
  237. animStringValueObject = getToolAnim(tool)
  238.  
  239. if animStringValueObject then
  240. toolAnim = animStringValueObject.Value
  241. -- message recieved, delete StringValue
  242. animStringValueObject.Parent = nil
  243. toolAnimTime = time + .3
  244. end
  245.  
  246. if time > toolAnimTime then
  247. toolAnimTime = 0
  248. toolAnim = "None"
  249. end
  250.  
  251. animateTool()
  252.  
  253.  
  254. else
  255. toolAnim = "None"
  256. toolAnimTime = 0
  257. end
  258. end
  259.  
  260.  
  261. -- connect events
  262.  
  263. Humanoid.Died:connect(onDied)
  264. Humanoid.Running:connect(onRunning)
  265. Humanoid.Jumping:connect(onJumping)
  266. Humanoid.Climbing:connect(onClimbing)
  267. Humanoid.GettingUp:connect(onGettingUp)
  268. Humanoid.FreeFalling:connect(onFreeFall)
  269. Humanoid.FallingDown:connect(onFallingDown)
  270. Humanoid.Seated:connect(onSeated)
  271. Humanoid.PlatformStanding:connect(onPlatformStanding)
  272.  
  273. -- main program
  274.  
  275. local runService = game:service("RunService");
  276.  
  277. plr = owner
  278. char = plr.Character
  279.  
  280. clerp = function(toclerp, cf, number)
  281. local joint = toclerp
  282. joint.C0 = joint.C0:Lerp(cf, number)
  283. end
  284.  
  285. clerp2 = function(toclerp, cf)
  286. local joint = toclerp
  287. joint.C0 = cf
  288. end
  289.  
  290. clerp3 = function(toclerp, cf, number)
  291. local joint = toclerp
  292. joint.C1 = joint.C1:Lerp(cf, number)
  293. end
  294.  
  295. Swait,swait = function(number)
  296. if number == 0 or number == nil then
  297. game:GetService("RunService").Heartbeat:Wait()
  298. else
  299. for i = 1,number do
  300. game:GetService("RunService").Heartbeat:Wait()
  301. end
  302. end
  303. end
  304.  
  305. ezweld = function(p, a, b, cf)
  306. local weld = Instance.new("Weld",p)
  307. weld.Part0 = a
  308. weld.Part1 = b
  309. weld.C0 = cf
  310. return weld
  311. end
  312.  
  313. NewSound = function(p, id, pit, vol, loop)
  314. local Sound = Instance.new("Sound",p)
  315. Sound.Pitch = pit
  316. Sound.Volume = vol
  317. Sound.SoundId = "rbxassetid://" ..id
  318. Sound.Looped = loop
  319. Sound:Play()
  320. return Sound
  321. end
  322.  
  323. local jomp = NewSound(Torso, 400942696, 1, 10, false)
  324. local wolk = NewSound(Torso, 174960816, 1, 10, true)
  325.  
  326. Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
  327. if Humanoid.Jump == true and jomp.Playing == false then
  328. jomp:Play()
  329. wolk:Stop()
  330. end
  331. end)
  332.  
  333. Humanoid.Running:connect(function(speed)
  334. if speed > 0 then
  335. wolk.Playing = true
  336. else
  337. wolk:Stop()
  338. end
  339. end)
  340.  
  341. function fake(part)
  342. local fake = Instance.new("Part", part.Parent)
  343. fake.Size = part.Size
  344. fake.Color = part.Color
  345. fake.Anchored = part.Anchored
  346. fake.CFrame = part.CFrame
  347. fake.CanCollide = true
  348. fake.Transparency = 1
  349. fake.Locked = true
  350. --fake.LeftSurface = part.LeftSurface
  351. --fake.RightSurface = part.RightSurface
  352. --fake.TopSurface = part.TopSurface
  353. --fake.BottomSurface = part.BottomSurface
  354. --fake.FrontSurface = part.FrontSurface
  355. --fake.BackSurface = part.BackSurface
  356. for i,v in pairs (part:children()) do
  357. if v:IsA("SpecialMesh") or v:IsA("Decal") then
  358. v:Clone().Parent = fake
  359. end
  360. end
  361. local weld = ezweld(part.Parent, fake, part, CFrame.new())
  362. return fake
  363. end
  364.  
  365. for i,v in pairs (char:GetDescendants()) do
  366. if v:IsA("Part") or v:IsA("MeshPart") then
  367. fake(v)
  368. end
  369. end
  370.  
  371. while runService.Heartbeat:Wait() do
  372. local _, time = wait(0)
  373. move(time)
  374. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement