Advertisement
Its_YeBoi

Untitled

Dec 6th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.65 KB | None | 0 0
  1. local Player = game:service("Players").LocalPlayer
  2. local syne = 0
  3. local Mouse = Player:GetMouse()
  4. local Char = Player.Character
  5. local mouse = Player:GetMouse()
  6. local Humanoid = Char:findFirstChild("Humanoid")
  7. local Torso = Char:findFirstChild("Torso")
  8. local deb = false
  9. local name = Player.Name
  10. local Head = Char.Head
  11. local ra = Char:findFirstChild("Right Arm")
  12. local la = Char:findFirstChild("Left Arm")
  13. local rl = Char:findFirstChild("Right Leg")
  14. local ll = Char:findFirstChild("Left Leg")
  15. local rs = Torso:findFirstChild("Right Shoulder")
  16. local ls = Torso:findFirstChild("Left Shoulder")
  17. local rh = Torso:findFirstChild("Right Hip")
  18. local lh = Torso:findFirstChild("Left Hip")
  19. local neck = Torso:findFirstChild("Neck")
  20. local rp = Char:findFirstChild("HumanoidRootPart")
  21. rp.Archivable = true
  22. local rj = rp:findFirstChild("RootJoint")
  23. rj.Archivable = true
  24. local animate = Char:findFirstChild("Animate")
  25. local rootpart = Char:findFirstChild("HumanoidRootPart")
  26. local Camera = workspace.CurrentCamera
  27. local CF = CFrame.new
  28. local components = CF().components
  29. rootpart.CanCollide = false
  30. Humanoid:findFirstChild("Animator"):Destroy()
  31.  
  32. local plr = game:GetService("Players").LocalPlayer
  33. local char = plr.Character
  34. local head = char.Head
  35. local torso = char.Torso
  36. local leftarm = char["Left Arm"]
  37. local rightarm = char["Right Arm"]
  38. local leftleg = char["Left Leg"]
  39. local rightleg = char["Right Leg"]
  40.  
  41. --Humanoid.CameraOffset = Vector3.new(0,2,0)
  42.  
  43. sine = 100
  44. angle = 100
  45. anglespeed = 100
  46. local anim = false
  47. local walking = false
  48.  
  49. Lerp = function(a,b,c)
  50. return a+(b-a)*c
  51. end
  52.  
  53. function ctlerp(c1,c2,al)
  54. local com1 = {c1:components()}
  55. local com2 = {c2:components()}
  56. for i,v in pairs(com1) do
  57. com1[i] = Lerp(v,com2[i],al)
  58. end
  59. return CF(unpack(com1))
  60. end
  61.  
  62. do
  63. local function QuaternionFromCFrame(cf)
  64. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  65. local trace = m00 + m11 + m22
  66. if trace > 0 then
  67. local s = math.sqrt(1 + trace)
  68. local recip = 0.5/s
  69. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  70. else
  71. local i = 0
  72. if m11 > m00 then
  73. i = 1
  74. end
  75. if m22 > (i == 0 and m00 or m11) then
  76. i = 2
  77. end
  78. if i == 0 then
  79. local s = math.sqrt(m00-m11-m22+1)
  80. local recip = 0.5/s
  81. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  82. elseif i == 1 then
  83. local s = math.sqrt(m11-m22-m00+1)
  84. local recip = 0.5/s
  85. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  86. elseif i == 2 then
  87. local s = math.sqrt(m22-m00-m11+1)
  88. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  89. end
  90. end
  91. end
  92. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  93. local xs, ys, zs = x + x, y + y, z + z
  94. local wx, wy, wz = w*xs, w*ys, w*zs
  95. local xx = x*xs
  96. local xy = x*ys
  97. local xz = x*zs
  98. local yy = y*ys
  99. local yz = y*zs
  100. local zz = z*zs
  101. return CF(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  102. end
  103. local function QuaternionSlerp(a, b, t)
  104. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  105. local startInterp, finishInterp;
  106. if cosTheta >= 0.0001 then
  107. if (1 - cosTheta) > 0.0001 then
  108. local theta = math.acos(cosTheta)
  109. local invSinTheta = 1/math.sin(theta)
  110. startInterp = math.sin((1-t)*theta)*invSinTheta
  111. finishInterp = math.sin(t*theta)*invSinTheta
  112. else
  113. startInterp = 1-t
  114. finishInterp = t
  115. end
  116. else
  117. if (1+cosTheta) > 0.0001 then
  118. local theta = math.acos(-cosTheta)
  119. local invSinTheta = 1/math.sin(theta)
  120. startInterp = math.sin((t-1)*theta)*invSinTheta
  121. finishInterp = math.sin(t*theta)*invSinTheta
  122. else
  123. startInterp = t-1
  124. finishInterp = t
  125. end
  126. end
  127. 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
  128. end
  129. function clerp(a,b,t)
  130. local qa = {QuaternionFromCFrame(a)}
  131. local qb = {QuaternionFromCFrame(b)}
  132. local ax, ay, az = a.x, a.y, a.z
  133. local bx, by, bz = b.x, b.y, b.z
  134. local _t = 1-t
  135. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  136. end
  137. end
  138.  
  139. rm = Instance.new("Weld", Torso)
  140. rm.C0 = CFrame.new(1.5, 0.5, 0) *CFrame.Angles(0, 0, 0)
  141. rm.C1 = CFrame.new(0, 0.5, 0)
  142. rm.Part0 = Torso
  143. rm.Part1 = ra
  144. lm = Instance.new("Weld", Torso)
  145. lm.C0 = CFrame.new(-1.5, 0.5, 0) *CFrame.Angles(0, 0, 0)
  146. lm.C1 = CFrame.new(0, 0.5, 0)
  147. lm.Part0 = Torso
  148. lm.Part1 = la
  149. rlegm = Instance.new("Weld", Torso)
  150. rlegm.C0 = CFrame.new(0.5, -1, 0) *CFrame.Angles(0, 0, 0)
  151. rlegm.C1 = CFrame.new(0, 1, 0)
  152. rlegm.Part0 = Torso
  153. rlegm.Part1 = rl
  154. llegm = Instance.new("Weld", Torso)
  155. llegm.C0 = CFrame.new(-0.5, -1, 0) *CFrame.Angles(0, 0, 0)
  156. llegm.C1 = CFrame.new(0, 1, 0)
  157. llegm.Part0 = Torso
  158. llegm.Part1 = ll
  159. neck.C0 = CFrame.new(0,1,0)
  160. neck.C1 = CFrame.new(0,-0.5,0)
  161. local an = false
  162. local attack = false
  163. local kick = false
  164.  
  165. function debounce(func) -- ex: example:Connect(debounce(function() end))
  166. local isRunning = false
  167. return function(...)
  168. if not isRunning then
  169. isRunning = true
  170.  
  171. func(...)
  172.  
  173. isRunning = false
  174. end
  175. end
  176. end
  177. local syne = 0
  178. local sit = false
  179. local ang = CFrame.Angles
  180. local kspin = false
  181.  
  182. local kpart = Instance.new("Part",char)
  183. kpart.Name = "Karambit"
  184. kpart.CanCollide=false
  185. kpart.Anchored=false
  186. kpart.Size=Vector3.new(0,0,0)
  187. local kuram=Instance.new("SpecialMesh",kpart)
  188. kuram.MeshId='rbxassetid://534351507'
  189. kuram.TextureId='rbxassetid://534351514'
  190. kuram.Scale=Vector3.new( -0.3, 0.35, -0.3)
  191. local kweld = Instance.new("Weld",kpart)
  192. kweld.Part1=ra
  193. kweld.Part0=kpart
  194. kweld.C0=CFrame.new(0,1.6,0)--*CFrame.Angles(0,math.rad(-90),0)
  195.  
  196. function kspina()
  197.  
  198. end
  199.  
  200.  
  201. Mouse.KeyDown:Connect(function(key)
  202. if key == "z" and sit == true then
  203. sit = false
  204. animpose = "Idle"
  205. elseif key == "z" and sit == false then
  206. sit = true
  207. animpose = "Sitting"
  208. end
  209. if key == "q" then
  210. --print(neck.C0)
  211. end
  212. end)
  213.  
  214. Mouse.Button1Down:Connect(function()
  215.  
  216.  
  217.  
  218. end)
  219.  
  220.  
  221.  
  222. game:GetService("RunService").Stepped:connect(function()
  223.  
  224. syne=syne+1
  225. angle = (angle % 100) + anglespeed/10
  226. rootpart.CanCollide = false
  227. local speed = Vector3.new(rootpart.Velocity.X, 0, rootpart.Velocity.Z).magnitude
  228.  
  229. if Torso.Velocity.Y > 1 and sit == false then
  230. animpose = "Jump"
  231.  
  232. elseif speed < 1 and an == false and sit == false then -- idle
  233. animpose = "Idle"
  234.  
  235. elseif speed > 2 and sit == false then -- walking
  236. walking = true
  237. animpose = "Moving"
  238.  
  239. end
  240. -- //ANIMS \\ --
  241. if animpose == "Idle" and kspin == false and attack == false and anim == false then -- idle
  242. anglespeed = .2
  243. rm.C0 = clerp(rm.C0, CFrame.new(1, .4, -.4) * CFrame.Angles(math.rad(72.466)+ math.sin(angle) * 0.02, math.rad(0), math.rad(-24)+ math.sin(angle) * 0.02), 0.1)
  244. lm.C0 = clerp(lm.C0, CFrame.new(-1.4, 0.6, 0.1) * CFrame.Angles(math.rad(-15) + math.sin(angle) * 0.02, math.rad(15), math.rad(-5) + -math.sin(angle) * 0.02), 0.1)
  245. rlegm.C0 = clerp(rlegm.C0, CFrame.new(0.5, -0.9+ -math.sin(angle) * 0.05, -0.1) * CFrame.Angles(math.rad(8.652), math.rad(0), math.rad(5.844)), 0.3)
  246. llegm.C0 = clerp(llegm.C0, CFrame.new(-0.5, -0.9+ -math.sin(angle) * 0.05, 0) * CFrame.Angles(math.rad(-6.99), math.rad(1.375), math.rad(-11.085)), 0.3)
  247. neck.C0 = clerp(neck.C0, CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(-6.245) + math.sin(angle) * 0.05, math.rad(0), math.sin(angle) * 0.01), 0.1)
  248. rj.C0 = clerp(rj.C0, CFrame.new(0, -0.2 + math.sin(angle) * 0.05, 0) * CFrame.Angles(math.rad(-90), 0, math.rad(180)), 0.3)
  249. kweld.Part1=ra
  250. kweld.C0=CFrame.new(0,.45,1)*CFrame.Angles(math.rad(90),math.rad(90),0)
  251. kuram.Offset = Vector3.new(0,.95,-.25)
  252. Humanoid.WalkSpeed = 16
  253.  
  254. elseif animpose == "Moving" and attack == false and anim == false and walking == true and an == false then -- walk
  255. anglespeed = 1
  256. rm.C0 = clerp(rm.C0, CFrame.new(1.5, 0.525, 0) * CFrame.Angles(-math.cos(syne/2.5)/10+math.rad(-55),0,math.rad(12.5)),.1)
  257. lm.C0 = clerp(lm.C0, CFrame.new(-1.5,0.525, 0) * CFrame.Angles(-math.cos(syne/2.5)/10+math.rad(-55),0,math.rad(-12.5)),.1)
  258. rlegm.C0 = clerp(rlegm.C0, CFrame.new(0.5, -0.9, 0) * CFrame.Angles(math.rad(30) + -math.sin(-angle*2), math.rad(0), math.rad(0)), 1.5)
  259. llegm.C0 = clerp(llegm.C0, CFrame.new(-0.5, -0.9, -0.1) * CFrame.Angles(math.rad(30) + math.sin(-angle*2), math.rad(0), math.rad(0)),1.5)
  260. neck.C0 = clerp(neck.C0, CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(40) + math.sin(angle) * 0.05, math.rad(0), math.sin(angle) * 0.01), 0.1)
  261. rj.C0 = clerp(rj.C0, CFrame.new(0, -0.2 + math.sin(angle) * 0.05, 0) * CFrame.Angles(math.rad(-140), 0, math.rad(180)), 0.3)
  262. Humanoid.WalkSpeed = 20
  263.  
  264. elseif animpose == "Jump" and attack == false and anim == false then
  265. anglespeed = 0.3
  266. rm.C0 = clerp(rm.C0, CFrame.new(1.5, 0.8, 0) * CFrame.Angles(math.rad(-5) + -math.sin(angle) * 0.02, math.rad(-15), math.rad(50) + math.sin(angle) * 0.02), 0.15)
  267. lm.C0 = clerp(lm.C0, CFrame.new(-1.5, 0.8, 0) * CFrame.Angles(math.rad(5) + math.sin(angle) * 0.02, math.rad(15), math.rad(-50) + -math.sin(angle) * 0.02), 0.15)
  268. rlegm.C0 = clerp(rlegm.C0, CFrame.new(0.5, -0.9, -0.1) * CFrame.Angles(math.rad(-15), math.rad(0), math.rad(15)), 0.15)
  269. llegm.C0 = clerp(llegm.C0, CFrame.new(-0.5, -0.9, -0.1) * CFrame.Angles(math.rad(-15), math.rad(0), math.rad(-15)), 0.15)
  270. neck.C0 = clerp(neck.C0, CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(-10) + math.sin(angle) * 0.05, math.rad(0), math.sin(angle) * 0.01), 0.15)
  271. rj.C0 = clerp(rj.C0, CFrame.new(0, 0 + math.sin(angle) * 0.05, 0) * CFrame.Angles(math.rad(-80), 0, math.rad(180)), 0.15)
  272.  
  273. elseif animpose == "Sitting" and attack == false and anim == false then
  274. anglespeed = 0.3
  275. Humanoid.WalkSpeed = 0
  276. char.Humanoid.Jump = false
  277. rm.C0 = clerp(rm.C0, CFrame.new(1.44, .46, 0) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(-20)+ math.sin(angle) * 0.02), 0.1)
  278. lm.C0 = clerp(lm.C0, CFrame.new(-1.34, .66, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-230) + -math.sin(angle) * 0.02), 0.1)
  279. rlegm.C0 = clerp(rlegm.C0, CFrame.new(0.4, -0.9, -0.6) * CFrame.Angles(math.rad(-25.652), math.rad(0), math.rad(5.844)), 0.3)
  280. llegm.C0 = clerp(llegm.C0, CFrame.new(-0.5, -0.9, 0) * CFrame.Angles(math.rad(-6.99), math.rad(1.375), math.rad(-11.085)), 0.3)
  281. neck.C0 = clerp(neck.C0, CFrame.new(0, 1, 0) * CFrame.Angles(math.rad(-40), math.rad(0), math.sin(angle) * 0.1), 0.1)
  282. rj.C0 = clerp(rj.C0, CFrame.new(0, -3, 0) * CFrame.Angles(math.rad(180*2), 0, math.rad(180)), 0.3)
  283. kweld.Part1=rp
  284. kweld.C0=CFrame.new(0,-2.5,-5)*CFrame.Angles(0,math.rad(90),math.rad(180))
  285. kuram.Offset = Vector3.new(0,0,0)
  286.  
  287. end
  288. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement