Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.17 KB | None | 0 0
  1. local plr = game:GetService("Players").foxynason
  2. local char = plr.Character
  3. local cf = CFrame.new
  4. local glove = script.Glove:Clone()
  5. glove.Parent = char
  6. script.Glove.Parent = nil
  7. local gloveweld = Instance.new("Weld", glove["glove part yes"])
  8. gloveweld.Part0 = char["Right Arm"]
  9. gloveweld.Part1 = gloveweld.Parent
  10. gloveweld.C0 = CFrame.new(0,-0.5/2,0) * CFrame.Angles(0,math.rad(180),0)
  11.  
  12. local Sword = script.Sword:Clone()
  13. Sword.Parent = char
  14. script.Sword.Parent = nil
  15. local sordweld = Instance.new("Weld", Sword)
  16. sordweld.Part0 = char["Right Arm"]
  17. sordweld.Part1 = sordweld.Parent
  18. sordweld.C0 = CFrame.new(0,-1.1,2.3) * CFrame.Angles(0,math.rad(180),0)
  19. equipped = false
  20. local Torso = char.Torso
  21. local sine = 0
  22.  
  23. local idle=0
  24. local Anim="Idle"
  25.  
  26. local attack = false
  27.  
  28. local cn = CFrame.new
  29. local mr = math.rad
  30. local angles = CFrame.Angles
  31. local ud = UDim2.new
  32. local c3 = Color3.new
  33.  
  34. IT = Instance.new
  35. CF = CFrame.new
  36. VT = Vector3.new
  37. RAD = math.rad
  38. C3 = Color3.new
  39. UD2 = UDim2.new
  40. BRICKC = BrickColor.new
  41. ANGLES = CFrame.Angles
  42. EULER = CFrame.fromEulerAnglesXYZ
  43. COS = math.cos
  44. ACOS = math.acos
  45. SIN = math.sin
  46. ASIN = math.asin
  47. ABS = math.abs
  48. MRANDOM = math.random
  49. FLOOR = math.floor
  50.  
  51. function clerp(a,b,t)
  52. local qa = {QuaternionFromCFrame(a)}
  53. local qb = {QuaternionFromCFrame(b)}
  54. local ax, ay, az = a.x, a.y, a.z
  55. local bx, by, bz = b.x, b.y, b.z
  56. local _t = 1-t
  57. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  58. end
  59.  
  60. function QuaternionFromCFrame(cf)
  61. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  62. local trace = m00 + m11 + m22
  63. if trace > 0 then
  64. local s = math.sqrt(1 + trace)
  65. local recip = 0.5/s
  66. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  67. else
  68. local i = 0
  69. if m11 > m00 then
  70. i = 1
  71. end
  72. if m22 > (i == 0 and m00 or m11) then
  73. i = 2
  74. end
  75. if i == 0 then
  76. local s = math.sqrt(m00-m11-m22+1)
  77. local recip = 0.5/s
  78. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  79. elseif i == 1 then
  80. local s = math.sqrt(m11-m22-m00+1)
  81. local recip = 0.5/s
  82. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  83. elseif i == 2 then
  84. local s = math.sqrt(m22-m00-m11+1)
  85. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  86. end
  87. end
  88. end
  89.  
  90. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  91. local xs, ys, zs = x + x, y + y, z + z
  92. local wx, wy, wz = w*xs, w*ys, w*zs
  93. local xx = x*xs
  94. local xy = x*ys
  95. local xz = x*zs
  96. local yy = y*ys
  97. local yz = y*zs
  98. local zz = z*zs
  99. 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))
  100. end
  101.  
  102. function QuaternionSlerp(a, b, t)
  103. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  104. local startInterp, finishInterp;
  105. if cosTheta >= 0.0001 then
  106. if (1 - cosTheta) > 0.0001 then
  107. local theta = math.acos(cosTheta)
  108. local invSinTheta = 1/math.sin(theta)
  109. startInterp = math.sin((1-t)*theta)*invSinTheta
  110. finishInterp = math.sin(t*theta)*invSinTheta
  111. else
  112. startInterp = 1-t
  113. finishInterp = t
  114. end
  115. else
  116. if (1+cosTheta) > 0.0001 then
  117. local theta = math.acos(-cosTheta)
  118. local invSinTheta = 1/math.sin(theta)
  119. startInterp = math.sin((t-1)*theta)*invSinTheta
  120. finishInterp = math.sin(t*theta)*invSinTheta
  121. else
  122. startInterp = t-1
  123. finishInterp = t
  124. end
  125. end
  126. 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
  127. end
  128.  
  129. function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  130. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  131. end
  132.  
  133. RootPart=char.HumanoidRootPart
  134. local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
  135. equipped=true
  136. local RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  137. RW, LW=Instance.new("Weld"), Instance.new("Weld")
  138. RW.Name="Right Shoulder" LW.Name="Left Shoulder"
  139. LH=Torso["Left Hip"]
  140. RH=Torso["Right Hip"]
  141. RootJoint=RootPart.RootJoint
  142. necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  143. local RHCF = CFrame.fromEulerAnglesXYZ(0, 1.6, 0)
  144. local LHCF = CFrame.fromEulerAnglesXYZ(0, -1.6, 0)
  145. hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
  146. coroutine.resume(coroutine.create(function()
  147. end))
  148. while wait() do
  149. if equipped==true or equipped==false then
  150. if attack==false then
  151. idle=idle+1
  152. else
  153. idle=0
  154. end
  155. if idle>=500 then
  156. if attack==false then
  157. --Sheath()
  158. end
  159. end
  160. if RootPart.Velocity.y > 1 and hitfloor==nil then
  161. Anim="Jump"
  162. if attack==false then
  163. RH.C0=clerp(RH.C0,cf(1,-0.35 - 0.05 * math.cos(sine / 25),-0.75)*angles(math.rad(0),math.rad(90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(-20)),.1)
  164. LH.C0=clerp(LH.C0,cf(-1,-1 - 0.05 * math.cos(sine / 25),0)*angles(math.rad(0),math.rad(-90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(20)),.1)
  165. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0 + 0.05 * math.cos(sine / 25))*angles(math.rad(-10),math.rad(0),math.rad(0)),.1)
  166. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*angles(math.rad(-2.5),math.rad(0),math.rad(0)),.1)
  167. RW.C0=clerp(RW.C0,cf(1.45,0.5 + 0.1 * math.cos(sine / 25),0)*angles(math.rad(-5),math.rad(0),math.rad(25)),.1)
  168. LW.C0=clerp(LW.C0,cf(-1.45,0.5 + 0.1 * math.cos(sine / 25),0)*angles(math.rad(-5),math.rad(0),math.rad(-25)),.1)
  169. end
  170. elseif RootPart.Velocity.y < -1 and hitfloor==nil then
  171. Anim="Fall"
  172. if attack==false then
  173. RH.C0=clerp(RH.C0,cf(1,-0.35 - 0.05 * math.cos(sine / 25),-0.75)*angles(math.rad(0),math.rad(90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(-20)),.1)
  174. LH.C0=clerp(LH.C0,cf(-1,-1 - 0.05 * math.cos(sine / 25),0)*angles(math.rad(0),math.rad(-90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(20)),.1)
  175. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0 + 0.05 * math.cos(sine / 25))*angles(math.rad(10),math.rad(0),math.rad(0)),.1)
  176. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*angles(math.rad(2.5),math.rad(0),math.rad(0)),.1)
  177. RW.C0=clerp(RW.C0,cf(1.45,0.5 + 0.1 * math.cos(sine / 25),0)*angles(math.rad(-15),math.rad(0),math.rad(55)),.1)
  178. LW.C0=clerp(LW.C0,cf(-1.45,0.5 + 0.1 * math.cos(sine / 25),0)*angles(math.rad(-15),math.rad(0),math.rad(-55)),.1)
  179. end
  180. elseif torvel<1 and hitfloor~=nil then
  181. Anim="Idle"
  182. if attack==false then
  183. RootJoint.C0=clerp(RootJoint.C0,RootCF*CF(0,0,-0.1+0.1*math.cos(sine/20))*angles(math.rad(-20),math.rad(0),math.rad(0)),0.15)
  184. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*angles(math.rad(-15*math.sin(sine/25)/2),math.rad(0),math.rad(10*math.sin(sine/25))),.3)
  185. RH.C0=clerp(RH.C0,CF(1,-0.9-0.1*math.cos(sine/20),0.025*math.cos(sine/20))*RHCF*angles(math.rad(-10),math.rad(-0),math.rad(-25)),0.15)
  186. LH.C0=clerp(LH.C0,CF(-1,-0.9-0.1*math.cos(sine/20),0.025*math.cos(sine/20))*LHCF*angles(math.rad(-3),math.rad(-4*math.sin(sine/25)),math.rad(15)),0.15)
  187. RW.C0 = clerp(RW.C0, CFrame.new(1.5, 0.5+0.04*math.sin(sine/25), 0) * angles(math.rad(-35 ), math.rad(-7*math.sin(sine/25)), math.rad(5)), 0.1)
  188. LW.C0 = clerp(LW.C0, CFrame.new(-1.5, 0.5+0.04*math.sin(sine/25),0) * angles(math.rad(-35 ), math.rad(7*math.sin(sine/25)), math.rad(-5)), 0.1)
  189. end
  190. end
  191. end
  192. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement