Mdbook

Untitled

Mar 6th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. --[[ By Sugerkid]]--
  2.  
  3. --//Main
  4. local Player = game.Players.LocalPlayer
  5. local Character = Player.Character
  6. local Mouse = Player:GetMouse()
  7. local Animate = Character:FindFirstChild("Animate")
  8. if Animate then Animate:Destroy() end
  9. local ShirtId = "rbxassetid://70347331"
  10. local PantsId = "rbxassetid://70347345"
  11.  
  12. local State = "Idle"
  13.  
  14. local Sitting = false
  15. local Animations = false
  16. local Sprinting = false
  17.  
  18. local rad = math.rad
  19. local sin = math.sin
  20. local cos = math.cos
  21.  
  22. --//Parts
  23. local RA = Character["Right Arm"]
  24. local LA = Character["Left Arm"]
  25. local RL = Character["Right Leg"]
  26. local LL = Character["Left Leg"]
  27. local T = Character["Torso"]
  28. local H = Character["Head"]
  29. local HRP = Character["HumanoidRootPart"]
  30. local Humanoid = Character["Humanoid"]
  31. Humanoid.JumpPower = 0
  32.  
  33. for i,v in pairs(Character:GetChildren()) do
  34. if v.ClassName == "Accessory" or v.ClassName == "Hat" then v:Destroy() end
  35. if v.ClassName == "Shirt" or v.ClassName == "Pants" then v:Destroy() end
  36. if v.ClassName == "BodyColors" then v:Destroy() end
  37. end
  38.  
  39. local Shirt = Instance.new('Shirt',Character)
  40. local Pants = Instance.new('Pants',Character)
  41. Shirt.ShirtTemplate = ShirtId
  42. Pants.PantsTemplate = PantsId
  43. wait()
  44.  
  45. T.BrickColor = BrickColor.new('Salmon')
  46. H.BrickColor = BrickColor.new('Salmon')
  47. RA.BrickColor = BrickColor.new('Salmon')
  48. LA.BrickColor = BrickColor.new('Salmon')
  49. RL.BrickColor = BrickColor.new('Salmon')
  50. LL.BrickColor = BrickColor.new('Salmon')
  51.  
  52. if H:FindFirstChild('face') then
  53. H.face.Texture = "rbxassetid://297312774"
  54. end
  55.  
  56. --//Funcs
  57. function Weld(x,y)
  58. local w = Instance.new("Weld")
  59. w.Part0 = x
  60. w.Part1 = y
  61. w.Name = tostring(y.Name).."_Weld"
  62. w.Parent = x
  63. return w
  64. end
  65.  
  66. function Clerp(start,destination,increment)
  67. local function slerp(a,b,c)return (1-c)*a+(c*b)end
  68. local c1 = {start.X,start.Y,start.Z,start:toEulerAnglesXYZ()}
  69. local c2 = {destination.X,destination.Y,destination.Z,destination:toEulerAnglesXYZ()}
  70. for i,v in pairs(c1)do c1[i] = slerp(v,c2[i],increment)end
  71. return CFrame.new(c1[1],c1[2],c1[3])*CFrame.Angles(c1[4],c1[5],c1[6])
  72. end
  73.  
  74. function CheckState()
  75. local XZMagnitude = Vector3.new(HRP.Velocity.X, 0, HRP.Velocity.Z).Magnitude
  76. local YMagnitude = Vector3.new(0, HRP.Velocity.Y, 0).Magnitude
  77.  
  78. if XZMagnitude > 2 then State = "Walking" elseif XZMagnitude < 2 then State = "Idle" end
  79. if YMagnitude > 1.5 then State = "Jumping" end
  80. if Sitting then State = "Sitting" end
  81. return State
  82. end
  83.  
  84. --//Welds
  85. local TW = Weld(HRP,T)
  86. local RAW = Weld(T,RA)
  87. local LAW = Weld(T,LA)
  88. local RLW = Weld(T,RL)
  89. local LLW = Weld(T,LL)
  90. local HW = Weld(T,H)
  91.  
  92. Mouse.KeyDown:connect(function(Key)
  93. if Key:lower() == "q" then
  94. Sitting = not Sitting
  95. end
  96. end)
  97.  
  98. function cap(n,x,f)
  99. if f==nil then f=false end
  100. if f then if x>n then x=n end else if x<n then x = n end end
  101. return x
  102. end
  103. --//Animate!
  104.  
  105. while true do
  106. game:GetService('RunService').RenderStepped:wait()
  107. local S = CheckState()
  108. if S == "Idle" and not Animations then
  109. local TR = sin(tick())/15
  110. TW.C0 = Clerp(TW.C0, CFrame.new(0,0,0)*CFrame.Angles(-TR/2,0,0), .1)
  111. HW.C0 = Clerp(HW.C0, CFrame.new(0,1.5,0)*CFrame.Angles(sin(tick())/20,0,0), .1)
  112. RAW.C0 = Clerp(RAW.C0, CFrame.new(1.4,0,-cap(-.5,TR))*CFrame.Angles(cap(-.5,TR),0,rad(15)), .1)
  113. LAW.C0 = Clerp(LAW.C0, CFrame.new(-1.4,0,-cap(-.5,TR))*CFrame.Angles(cap(-.5,TR),0,-rad(15)), .1)
  114. RLW.C0 = Clerp(RLW.C0, CFrame.new(.5+rad(9),-2,-TR/2)*CFrame.Angles(TR/2,0,rad(10)), .1)
  115. LLW.C0 = Clerp(LLW.C0, CFrame.new(-.5-rad(9),-2,-TR/2)*CFrame.Angles(TR/2,0,-rad(10)), .1)
  116. elseif S == "Walking" and not Animations then
  117. local R = sin(HRP.RotVelocity.Y/15)/3
  118. local TR = sin(tick()*7)/2*Humanoid.WalkSpeed/16
  119. HW.C0 = Clerp(HW.C0, CFrame.new(0,1.5,0)*CFrame.Angles(0,0,0), .1)
  120. TW.C0 = Clerp(TW.C0, CFrame.new(0,0,0)*CFrame.Angles(0,0,R), .1)
  121. RAW.C0 = Clerp(RAW.C0, CFrame.new(1.4,0,-TR)*CFrame.Angles(TR,0,rad(15)-cap(0,R)), .1)
  122. LAW.C0 = Clerp(LAW.C0, CFrame.new(-1.4,0,TR)*CFrame.Angles(-TR,0,-rad(15)-cap(0,R)), .1)
  123. RLW.C0 = Clerp(RLW.C0, CFrame.new(.5+rad(2),-2,TR*1.5)*CFrame.Angles(-TR*1.5,0,rad(3)-R), .1)
  124. LLW.C0 = Clerp(LLW.C0, CFrame.new(-.5-rad(2),-2,-TR*1.5)*CFrame.Angles(TR*1.5,0,-rad(3)-R), .1)
  125. elseif S == "Sitting" and not Animations then
  126. TW.C0 = Clerp(TW.C0, CFrame.new(0,-1.9,0)*CFrame.Angles(rad(20),0,0), .1)
  127. HW.C0 = Clerp(HW.C0, CFrame.new(0,1.45,-rad(20))*CFrame.Angles(-rad(20),0,0), .1)
  128. RAW.C0 = Clerp(RAW.C0, CFrame.new(1.4+rad(5),0,rad(30))*CFrame.Angles(-rad(30),0,rad(5)), .1)
  129. LAW.C0 = Clerp(LAW.C0, CFrame.new(-1.4-rad(5),0,rad(30))*CFrame.Angles(-rad(30),0,-rad(5)), .1)
  130. RLW.C0 = Clerp(RLW.C0, CFrame.new(.5,-2+rad(60),-rad(60))*CFrame.Angles(rad(40),0,0), .1)
  131. LLW.C0 = Clerp(LLW.C0, CFrame.new(-.5,-2+rad(60)/2,-rad(60))*CFrame.Angles(rad(60),0,0), .1)
  132. end
  133. end
Add Comment
Please, Sign In to add comment