Advertisement
mathmasterphil

Dancer

Mar 7th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.40 KB | None | 0 0
  1. --jarredbcv's dancer
  2. --Credit to madiik for his nice clerp function :)
  3. do
  4.         local function QuaternionFromCFrame(cf)
  5.                 local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  6.                 local trace = m00 + m11 + m22
  7.                 if trace > 0 then
  8.                         local s = math.sqrt(1 + trace)
  9.                         local recip = 0.5/s
  10.                         return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  11.                 else
  12.                         local i = 0
  13.                         if m11 > m00 then
  14.                                 i = 1
  15.                         end
  16.                         if m22 > (i == 0 and m00 or m11) then
  17.                                 i = 2
  18.                         end
  19.                         if i == 0 then
  20.                                 local s = math.sqrt(m00-m11-m22+1)
  21.                                 local recip = 0.5/s
  22.                                 return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  23.                         elseif i == 1 then
  24.                                 local s = math.sqrt(m11-m22-m00+1)
  25.                                 local recip = 0.5/s
  26.                                 return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  27.                         elseif i == 2 then
  28.                                 local s = math.sqrt(m22-m00-m11+1)
  29.                                 local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  30.                         end
  31.                 end
  32.         end
  33.         local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  34.                 local xs, ys, zs = x + x, y + y, z + z
  35.                 local wx, wy, wz = w*xs, w*ys, w*zs
  36.                 local xx = x*xs
  37.                 local xy = x*ys
  38.                 local xz = x*zs
  39.                 local yy = y*ys
  40.                 local yz = y*zs
  41.                 local zz = z*zs
  42.                 return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  43.                 end  
  44.         local function QuaternionSlerp(a, b, t)
  45.                 local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  46.                 local startInterp, finishInterp;
  47.                 if cosTheta >= 0.0001 then
  48.                         if (1 - cosTheta) > 0.0001 then
  49.                                 local theta = math.acos(cosTheta)
  50.                                 local invSinTheta = 1/math.sin(theta)
  51.                                 startInterp = math.sin((1-t)*theta)*invSinTheta
  52.                                 finishInterp = math.sin(t*theta)*invSinTheta  
  53.                         else
  54.                                 startInterp = 1-t
  55.                                 finishInterp = t
  56.                         end
  57.                 else
  58.                         if (1+cosTheta) > 0.0001 then
  59.                                 local theta = math.acos(-cosTheta)
  60.                                 local invSinTheta = 1/math.sin(theta)
  61.                                 startInterp = math.sin((t-1)*theta)*invSinTheta
  62.                                 finishInterp = math.sin(t*theta)*invSinTheta
  63.                         else
  64.                                 startInterp = t-1
  65.                                 finishInterp = t
  66.                         end
  67.                 end
  68.                 return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  69.         end  
  70.         function clerp(a,b,t)
  71.                 local qa = {QuaternionFromCFrame(a)}
  72.                 local qb = {QuaternionFromCFrame(b)}
  73.                 local ax, ay, az = a.x, a.y, a.z
  74.                 local bx, by, bz = b.x, b.y, b.z  
  75.                 local _t = 1-t
  76.                 return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  77.         end
  78.  
  79. end
  80. do
  81. plr = game:service'Players'.LocalPlayer
  82. char = plr.Character
  83. mouse = plr:GetMouse()
  84. humanoid = char:findFirstChild("Humanoid")
  85. torso = char:findFirstChild("Torso")
  86. head = char.Head
  87. ra = char:findFirstChild("Right Arm")
  88. la = char:findFirstChild("Left Arm")
  89. rl = char:findFirstChild("Right Leg")
  90. ll = char:findFirstChild("Left Leg")
  91. rs = torso:findFirstChild("Right Shoulder")
  92. ls = torso:findFirstChild("Left Shoulder")
  93. rh = torso:findFirstChild("Right Hip")
  94. lh = torso:findFirstChild("Left Hip")
  95. neck = torso:findFirstChild("Neck")
  96. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  97. anim = char:findFirstChild("Animate")
  98. rootpart = char:findFirstChild("HumanoidRootPart")
  99. camera = workspace.CurrentCamera
  100. if anim then
  101. anim:Destroy()
  102. end
  103.  
  104. local rm = Instance.new("Motor", torso)
  105. rm.C0 = CFrame.new(1.5, 0.5, 0)
  106. rm.C1 = CFrame.new(0, 0.5, 0)
  107. rm.Part0 = torso
  108. rm.Part1 = ra
  109. local lm = Instance.new("Motor", torso)
  110. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  111. lm.C1 = CFrame.new(0, 0.5, 0)
  112. lm.Part0 = torso
  113. lm.Part1 = la
  114.  
  115. local rlegm = Instance.new("Motor", torso)
  116. rlegm.C0 = CFrame.new(0.5, -1, 0)
  117. rlegm.C1 = CFrame.new(0, 1, 0)
  118. rlegm.Part0 = torso
  119. rlegm.Part1 = rl
  120. local llegm = Instance.new("Motor", torso)
  121. llegm.C0 = CFrame.new(-0.5, -1, 0)
  122. llegm.C1 = CFrame.new(0, 1, 0)
  123. llegm.Part0 = torso
  124. llegm.Part1 = ll
  125.  
  126. neck.C0 = CFrame.new(0, 1, 0)
  127. neck.C1 = CFrame.new(0, -0.5, 0)
  128.  
  129.  
  130. rj.C0 = CFrame.new()
  131. rj.C1 = CFrame.new()
  132.  
  133. local sound = Instance.new("Sound", head)
  134. sound.SoundId = "http://www.roblox.com/asset/?id=130797915"
  135. sound.Volume = 0.8
  136. sound.Looped = true
  137.  
  138. for _,v in pairs(char:GetChildren()) do if v.ClassName=="Hat" then v:remove() end end
  139.  
  140. local speed = 0.3
  141. local angle = 0
  142. local humanwalk = true
  143. local anglespeed = 1
  144. rsc0 = rm.C0
  145. lsc0 = lm.C0
  146. llc0 = llegm.C0
  147. rlc0 = rlegm.C0
  148. neckc0 = neck.C0
  149.  
  150. local controllerService = game:GetService("ControllerService")
  151. local controller = controllerService:GetChildren()[1]
  152.  
  153. controller.Parent = nil
  154.  
  155. Instance.new("HumanoidController", game:service'ControllerService')
  156. Instance.new("SkateboardController", game:service'ControllerService')
  157. Instance.new("VehicleController", game:service'ControllerService')
  158. local controller = controllerService:GetChildren()[1]
  159. print("Made by jarredbcv, but credit goes to madiik for clerp")
  160. mouse.KeyDown:connect(function(k)
  161.     if k == "q" then
  162.         if not sound.IsPlaying then
  163.             game:service'InsertService':LoadAsset(1029025):children()[1].Parent = char
  164.             sound:stop()
  165.             sound.SoundId = "http://www.roblox.com/asset/?id=157460849"
  166.             wait()
  167.             sound:play()
  168.         end
  169.     end
  170.     if k == "e" then
  171.         if not sound.IsPlaying then
  172.             game:service'InsertService':LoadAsset(1073690):children()[1].Parent = char
  173.             sound:stop()
  174.             sound.SoundId = "http://www.roblox.com/asset/?id=149069781"
  175.             wait()
  176.             sound:play()
  177.         end
  178.     end
  179.         if k == "r" then
  180.         if not sound.IsPlaying then
  181.             game:service'InsertService':LoadAsset(47697285):children()[1].Parent = char
  182.             game:service'InsertService':LoadAsset(11748356):children()[1].Parent = char
  183.             sound:stop()
  184.             sound.SoundId = "http://www.roblox.com/asset/?id=149410799"
  185.             wait()
  186.             sound:play()
  187.         end
  188.     end
  189.         if k == "t" then
  190.         if not sound.IsPlaying then
  191.             game:service'InsertService':LoadAsset(10911990):children()[1].Parent = char
  192.             sound:stop()
  193.             sound.SoundId = "http://www.roblox.com/asset/?id=130791919"
  194.             wait()
  195.             sound:play()
  196.         end
  197.     end
  198.          if k == "y" then
  199.         if not sound.IsPlaying then
  200.             game:service'InsertService':LoadAsset(128159229):children()[1].Parent = char
  201.             sound:stop()
  202.             sound.SoundId = "http://www.roblox.com/asset/?id=148952593"
  203.             wait()
  204.             sound:play()
  205.         end
  206.     end
  207.          if k == "u" then
  208.         if not sound.IsPlaying then
  209.             game:service'InsertService':LoadAsset(87261721):children()[1].Parent = char
  210.             sound:stop()
  211.             sound.SoundId = "http://www.roblox.com/asset/?id=143331844"
  212.             wait()
  213.             sound:play()
  214.         end
  215.     end
  216.          if k == "p" then
  217.         if not sound.IsPlaying then
  218.             game:service'InsertService':LoadAsset(22432792):children()[1].Parent = char
  219.             sound:stop()
  220.             sound.SoundId = "http://www.roblox.com/asset/?id=154724577"
  221.             wait()
  222.             sound:play()
  223.         end
  224.     end
  225.  if string.byte(k) == 48 then
  226.         humanoid.WalkSpeed = 34
  227.     end
  228.    
  229. end)
  230. mouse.KeyUp:connect(function(k)
  231.    
  232.     if string.byte(k) == 48 then
  233.         humanoid.WalkSpeed = 16
  234.     end
  235.    
  236. end)
  237.  
  238.    
  239.  
  240. while wait() do
  241.     angle = (angle % 100) + anglespeed/10 -- i don't see any function getting called here
  242.         mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
  243.         local rscf = rsc0
  244.         local lscf = lsc0
  245.         local rlcf = rlc0
  246.         local llcf = llc0
  247.         local rjcf = CFrame.new()
  248.         local ncf = neckc0
  249.         local rayz = Ray.new(rootpart.Position, Vector3.new(0, -6, 0))
  250.             local hitz, enz = workspace:findPartOnRay(rayz, char)
  251.             if not hitz then
  252.         if sound.IsPlaying then
  253.             sound:stop()
  254.         end
  255. elseif humanoid.Sit then
  256.         if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=157460849" then
  257.         anglespeed = 2
  258.         ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  259.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  260.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  261.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  262.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  263.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  264.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149069781" then
  265.         anglespeed = 6
  266.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  267.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  268.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  269.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  270.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  271.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  272.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149410799" then
  273.         anglespeed = 6
  274.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  275.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  276.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  277.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  278.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  279.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  280.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130791919" then
  281.         anglespeed = 6
  282.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  283.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  284.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  285.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  286.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  287.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  288.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=148952593" then
  289.         anglespeed = 6
  290.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  291.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  292.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  293.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  294.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  295.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  296.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=143331844" then
  297.         anglespeed = 6
  298.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  299.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  300.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  301.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  302.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  303.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  304.         elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=154724577" then
  305.         anglespeed = 6
  306.         ncf = neckc0 * CFrame.Angles(math.pi/5-math.sin(angle)*0.1, 0, 0)
  307.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, 0, 0)
  308.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  309.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  310.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  311.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  312.         else
  313.         anglespeed = 1/2
  314.         ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  315.         rjcf = CFrame.new(0, -0.8, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  316.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  317.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  318.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  319.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  320.         end
  321.     elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
  322.             if sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=157460849" then
  323.             anglespeed = 3
  324.             ncf = neckc0 * CFrame.Angles(math.sin(angle)*0.07, math.rad(30), 0)
  325.             rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
  326.             rscf = rsc0 * CFrame.Angles(-math.sin(angle)*.2, 0, math.sin(angle)*.2)
  327.             lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.05, 0, 0)
  328.             rlcf = rlc0 * CFrame.new(0, -0.1 + math.abs(mvmnt)*0.1, -0.1) * CFrame.Angles(0, math.rad(5), math.rad(5))
  329.             llcf = llc0 * CFrame.Angles(0, math.rad(2.5), math.rad(1))
  330.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149069781" then
  331.             anglespeed = 2
  332.             ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3,0, 0)
  333.             rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*.5, 0)
  334.             rscf = rsc0 * CFrame.Angles(0, 0, math.pi/2+math.abs(math.sin(angle)*1))
  335.             lscf = lsc0 * CFrame.Angles(0, 0, -math.pi/2-math.abs(math.sin(angle)*1))
  336.             rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5))
  337.             llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5))
  338.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=149410799" then
  339.             anglespeed = 2
  340.             ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3,0, 0)
  341.             rjcf = CFrame.new(math.sin(angle)*2, 0, 0) * CFrame.Angles(-math.pi/20, math.sin(angle)*.5, 0)
  342.             rscf = rsc0 * CFrame.Angles(math.pi/3+math.abs(math.sin(angle)*.5), math.pi/20,  -math.pi/20)
  343.             lscf = lsc0 * CFrame.Angles(math.pi/3+math.abs(math.sin(angle)*.5), -math.pi/20,  math.pi/20)
  344.             rlcf = rlc0 * CFrame.Angles(math.pi/20+math.sin(angle)*0.2, math.sin(angle)*0.08, math.rad(2.5))
  345.             llcf = llc0 * CFrame.Angles(math.pi/20-math.sin(angle)*0.2, -math.sin(angle)*0.08, -math.rad(2.5))
  346.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=130791919" then
  347.             anglespeed = 2
  348.             ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3,0, 0)
  349.             rjcf = CFrame.new(math.sin(angle)*3, -1, 0) * CFrame.Angles(-math.pi/2, math.sin(angle)*-2, 0)
  350.             rscf = rsc0 * CFrame.Angles(math.pi/1+math.sin(angle)*1.5, 0,  0)
  351.             lscf = lsc0 * CFrame.Angles(math.pi/1-math.sin(angle)*1.5, 0,  0)
  352.             rlcf = rlc0 * CFrame.Angles(math.pi/20+math.sin(angle)*1.5, 0, 0)
  353.             llcf = llc0 * CFrame.Angles(math.pi/20-math.sin(angle)*1.5, 0, 0)
  354.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=148952593" then
  355.             anglespeed = 1
  356.             ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.5,0, 0)
  357.             rjcf = CFrame.new(0, 0, math.sin(angle)*3) * CFrame.Angles(0, math.sin(angle)*0.1, 0)
  358.             rscf = rsc0 * CFrame.Angles(0, 0,  -math.pi/20+math.sin(angle)*.75)
  359.             lscf = lsc0 * CFrame.Angles(0, 0,  math.pi/20+math.sin(angle)*.75)
  360.             rlcf = rlc0 * CFrame.Angles(math.pi/20+math.sin(angle)*.75, 0, 0)
  361.             llcf = llc0 * CFrame.Angles(math.pi/20-math.sin(angle)*.75, 0, 0)
  362.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=143331844" then
  363.             anglespeed = 2
  364.             ncf = neckc0 * CFrame.Angles(0,0, 0)
  365.             rjcf = CFrame.new(0, -math.abs(math.sin(angle))*1.5, 0) * CFrame.Angles(math.sin(angle)*2, 0, 0)
  366.             rscf = rsc0 * CFrame.Angles(0, 0,  0)
  367.             lscf = lsc0 * CFrame.Angles(0, 0,  0)
  368.             rlcf = rlc0 * CFrame.Angles(0, 0, 0)
  369.             llcf = llc0 * CFrame.Angles(0, 0, 0)
  370.             elseif sound.IsPlaying and sound.SoundId == "http://www.roblox.com/asset/?id=154724577" then
  371.             anglespeed = 7
  372.             ncf = neckc0 * CFrame.Angles(math.pi/10-math.abs(math.sin(angle))*0.3,0, 0)
  373.             rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*.5, 0)
  374.             rscf = rsc0 * CFrame.Angles(math.pi/3+math.abs(math.sin(angle)*1), math.pi/20,  -math.pi/20)
  375.             lscf = lsc0 * CFrame.Angles(math.pi/3+math.abs(math.sin(angle)*1), -math.pi/20,  math.pi/20)
  376.             rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.1, math.rad(2.5))
  377.             llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*1, -math.rad(2.5))
  378.             else
  379.             if humanwalk then
  380.                         anglespeed = 1/4
  381.         ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
  382.         rjcf = CFrame.new(0, 0, 0) * CFrame.Angles(0, math.sin(angle)*0.001, 0)
  383.         rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.1, 0, 0)
  384.         lscf = lsc0 * CFrame.Angles(math.sin(-angle)*0.1, 0, 0)
  385.         rlcf = rlc0 * CFrame.Angles(0, math.sin(angle)*0.08, math.rad(2.5))
  386.         llcf = llc0 * CFrame.Angles(0, -math.sin(angle)*0.08, -math.rad(2.5))
  387.                 else
  388.         anglespeed = 1/2
  389.         ncf = neckc0 * CFrame.Angles(math.pi/5, 0, math.sin(angle)*0.08)
  390.         rjcf = CFrame.new(0, -2, 0) * CFrame.Angles(-math.pi/5, math.sin(angle)*0.01, 0)
  391.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, -math.rad(15))
  392.         lscf = lsc0 * CFrame.new(.45, 0.2, -.3) * CFrame.Angles(math.pi/3, 0, math.rad(15))
  393.         rlcf = rlc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, math.rad(20))
  394.         llcf = llc0 * CFrame.Angles(math.pi/2+math.pi/5, 0, -math.rad(20))
  395.             end
  396.         end
  397.     elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 20 then
  398.         if sound.IsPlaying then
  399.             sound:stop()
  400.             for _,v in pairs(char:GetChildren()) do if v.ClassName=="Hat" then v:remove() end end
  401.         end
  402.         if humanwalk then
  403.                                 anglespeed = 4
  404.         ncf = neckc0 * CFrame.Angles(math.pi/24, mvmnt*.02, 0)
  405.         rjcf = CFrame.new(0, math.abs(mvmnt)*0.05, 0) * CFrame.Angles(math.pi/24, -mvmnt*.02, 0)
  406.         rscf = rsc0 * CFrame.Angles(math.sin(angle)*1.25, 0, -math.abs(mvmnt)*0.02)
  407.         lscf = lsc0 * CFrame.Angles(math.sin(-angle)*1.25, 0, math.abs(mvmnt)*0.02)
  408.         rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*1, 0, math.rad(.5))
  409.         llcf = llc0 * CFrame.Angles(math.sin(angle)*1, 0, -math.rad(.5))
  410.                 else
  411.         anglespeed = 4
  412.         ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9, 0, 0)
  413.         rjcf = CFrame.new(0, -1.5+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9, math.sin(mvmnt/2)*0.05, 0)
  414.         rscf = rsc0 * CFrame.new(-.45, 0.2, -.4+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(angle)*0.7, 0, math.rad(5))
  415.         lscf = lsc0 * CFrame.new(.45, 0.2, .1-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2+math.sin(-angle)*0.7, 0, -math.rad(5))
  416.         rlcf = rlc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*0.6, 0, math.abs(mvmnt)*0.025)
  417.         llcf = llc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(angle)*.6, 0, -math.abs(mvmnt)*0.025)
  418.         end
  419.     elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then
  420.         if sound.IsPlaying then
  421.             sound:stop()
  422.         for _,v in pairs(char:GetChildren()) do if v.ClassName=="Hat" then v:remove() end end
  423.         end
  424.         if humanwalk then
  425.         anglespeed = 5
  426.         ncf = neckc0 * CFrame.Angles(-math.pi/20, math.sin(angle)*.04, 0)
  427.         rjcf = CFrame.new(0, -.4 + math.abs(mvmnt)*0.25, 0) * CFrame.Angles(0, -math.sin(angle)*.08, 0)
  428.         rscf = rsc0 * CFrame.new(0, 0, -.3+math.abs(mvmnt)*0.125) *  CFrame.Angles(math.pi/18+math.sin(angle)*1.5, 0, -math.abs(mvmnt)*0.02)
  429.         lscf = lsc0 * CFrame.new(0, 0, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/18+math.sin(-angle)*1.5, 0, math.abs(mvmnt)*0.02)
  430.         rlcf = rlc0 * CFrame.new(0, 0, -.6+math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5))
  431.         llcf = llc0 * CFrame.new(0, 0, -math.abs(mvmnt)*0.125) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5))
  432.         else
  433.         anglespeed = 5.5
  434.         ncf = neckc0 * CFrame.new(0, 0, .2) * CFrame.Angles(math.pi/1.9+math.sin(mvmnt/2)*0.05, 0, 0)
  435.         rjcf = CFrame.new(0, -1.3+math.abs(mvmnt)*0.05, 0) * CFrame.Angles(-math.pi/1.9+math.abs(mvmnt/2)*0.1, 0, 0)
  436.         rscf = rsc0 * CFrame.new(-1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, math.rad(5))
  437.         lscf = lsc0 * CFrame.new(1, 0.2, -.5) * CFrame.Angles(math.pi/2+math.sin(angle)*1.8, 0, -math.rad(5))
  438.         rlcf = rlc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, -.3+math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, math.abs(mvmnt)*0.025)
  439.         llcf = llc0 * CFrame.new(0, .3-math.abs(mvmnt)*0.125, .3-math.abs(mvmnt)*0.125) * CFrame.Angles(math.pi/2.5+math.sin(-angle)*1.4, 0, -math.abs(mvmnt)*0.025)
  440.         end
  441.     end
  442.        
  443.     rm.C0 = clerp(rm.C0,rscf,speed)
  444.     lm.C0 = clerp(lm.C0,lscf,speed)
  445.     rj.C0 = clerp(rj.C0,rjcf,speed)
  446.     neck.C0 = clerp(neck.C0,ncf,speed)
  447.     rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  448.     llegm.C0 = clerp(llegm.C0,llcf,speed)
  449. end
  450.  
  451.  
  452. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement