Advertisement
Gametoy

ayyy

Feb 20th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.59 KB | None | 0 0
  1.  
  2. --[[Pacifist class created by Brannon1964802.]]--
  3.  
  4. Player=game:GetService("Players").LocalPlayer
  5. Instance.new("ForceField", game.Players.LocalPlayer.Character). Visible = false
  6. Character=Player.Character
  7. PlayerGui=Player.PlayerGui
  8. Backpack=Player.Backpack
  9. Torso=Character.Torso
  10. Head=Character.Head
  11. Humanoid=Character.Humanoid
  12. m=Instance.new('Model',Character)
  13. LeftArm=Character["Left Arm"]
  14. LeftLeg=Character["Left Leg"]
  15. RightArm=Character["Right Arm"]
  16. RightLeg=Character["Right Leg"]
  17. LS=Torso["Left Shoulder"]
  18. LH=Torso["Left Hip"]
  19. RS=Torso["Right Shoulder"]
  20. RH=Torso["Right Hip"]
  21. Face = Head.face
  22. Neck=Torso.Neck
  23. --it=Instance.new
  24. attacktype=1
  25. vt=Vector3.new
  26. cf=CFrame.new
  27. euler=CFrame.fromEulerAnglesXYZ
  28. angles=CFrame.Angles
  29. cloaked=true
  30. necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  31. necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  32. LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
  33. LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
  34. RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
  35. RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
  36. RootPart=Character.HumanoidRootPart
  37. RootJoint=RootPart.RootJoint
  38. RootCF=euler(-1.57,0,3.14)
  39. attack = false
  40. attackdebounce = false
  41. deb=true
  42. equipped=true
  43. hand=false
  44. MMouse=nil
  45. combo=0
  46. mana=0
  47. trispeed=.2
  48. attackmode='none'
  49. local idle=0
  50. local Anim="Idle"
  51. local gun=false
  52. local shoot=false
  53. player=nil
  54. mana=0
  55.  
  56. local defensevalue = .3
  57. local speedvalue = 1
  58. local damagevalue = 1
  59. local cf = CFrame.new-- make things easier :)
  60. local mr = math.rad
  61. local angles = CFrame.Angles
  62. local ud = UDim2.new
  63. local c3 = Color3.new
  64.  
  65. local stats=Instance.new('Folder',Character)
  66. stats.Name='Stats'
  67. local block=Instance.new('BoolValue',stats)
  68. block.Name='Block'
  69. block.Value=false
  70. local stun=Instance.new('BoolValue',stats)
  71. stun.Name='Stun'
  72. stun.Value=false
  73. local defense=Instance.new('NumberValue',stats)
  74. defense.Name='Defence'
  75. defense.Value=defensevalue
  76. local speed=Instance.new('NumberValue',stats)
  77. speed.Name='Speed'
  78. speed.Value=speedvalue
  79. local damagea=Instance.new('NumberValue',stats)
  80. damagea.Name='Damage'
  81. damagea.Value=damagevalue
  82.  
  83. Humanoid = Character.Humanoid
  84. if Humanoid:FindFirstChild("Animator")then
  85. Humanoid:FindFirstChild("Animator"):Destroy()
  86. end
  87.  
  88. Humanoid.WalkSpeed = 3
  89.  
  90. music = Instance.new("Sound", Torso)
  91. music.SoundId = "http://www.roblox.com/asset/?id=1360233504"
  92. music.Volume = 1
  93. music.Looped = true
  94. wait(0.1)
  95. music:Play()
  96.  
  97. Colorpart1 = Torso.BrickColor.r
  98. Colorpart2 = Torso.BrickColor.g
  99. Colorpart3 = Torso.BrickColor.b
  100.  
  101. CloakEffectLight2 = Instance.new("PointLight", Torso)
  102. CloakEffectLight2.Color = Color3.new(Colorpart1, Colorpart2, Colorpart3)
  103. CloakEffectLight2.Range = 7.5
  104. CloakEffectLight2.Brightness = 7.5
  105. CloakEffectLight2.Enabled = true
  106.  
  107. mouse=Player:GetMouse()
  108. --save shoulders
  109. RSH, LSH=nil, nil
  110. --welds
  111. RW, LW=Instance.new("Motor"), Instance.new("Motor")
  112. RW.Name="Right Shoulder" LW.Name="Left Shoulder"
  113. LH=Torso["Left Hip"]
  114. RH=Torso["Right Hip"]
  115. TorsoColor=Torso.BrickColor
  116. function NoOutline(Part)
  117. Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
  118. end
  119. player=Player
  120. ch=Character
  121. RSH=ch.Torso["Right Shoulder"]
  122. LSH=ch.Torso["Left Shoulder"]
  123. --
  124. RSH.Parent=nil
  125. LSH.Parent=nil
  126. --
  127. RW.Name="Right Shoulder"
  128. RW.Part0=ch.Torso
  129. RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
  130. RW.C1=cf(0, 0.5, 0)
  131. RW.Part1=ch["Right Arm"]
  132. RW.Parent=ch.Torso
  133. --
  134. LW.Name="Left Shoulder"
  135. LW.Part0=ch.Torso
  136. LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
  137. LW.C1=cf(0, 0.5, 0)
  138. LW.Part1=ch["Left Arm"]
  139. LW.Parent=ch.Torso
  140.  
  141. local function weldBetween(a, b)
  142. local weldd = Instance.new("ManualWeld")
  143. weldd.Part0 = a
  144. weldd.Part1 = b
  145. weldd.C0 = CFrame.new()
  146. weldd.C1 = b.CFrame:inverse() * a.CFrame
  147. weldd.Parent = a
  148. return weldd
  149. end
  150.  
  151. fat = Instance.new("BindableEvent", script)
  152. fat.Name = "Heartbeat"
  153.  
  154. script:WaitForChild("Heartbeat")
  155.  
  156. frame = 1 / 30
  157. tf = 0
  158. allowframeloss = false --if set to true will fire every frame it possibly can. This will result in multiple events happening at the same time whenever delta returns frame*2 or greater.
  159. tossremainder = false --if set to true t will be set to 0 after Fire()-ing.
  160. lastframe = tick()
  161. script.Heartbeat:Fire() --ayy lmao
  162.  
  163. game:GetService("RunService").Heartbeat:connect(function(s, p) --herp derp
  164. tf = tf + s
  165. if tf >= frame then
  166. if allowframeloss then
  167. script.Heartbeat:Fire()
  168. lastframe = tick()
  169. else
  170. --print("FIRED "..math.floor(t/frame).." FRAME(S)","REMAINDER "..(t - frame*(math.floor(t/frame))))
  171. for i = 1, math.floor(tf / frame) do
  172. script.Heartbeat:Fire()
  173. end
  174. lastframe = tick()
  175. end
  176. if tossremainder then
  177. tf = 0
  178. else
  179. tf = tf - frame * math.floor(tf / frame)
  180. end
  181. end
  182. end)
  183.  
  184. --To use: fat.Event:fat.Event:wait() or fat.Event:connect(function() asdcode end)
  185.  
  186. local function CFrameFromTopBack(at, top, back)
  187. local right = top:Cross(back)
  188. return CFrame.new(at.x, at.y, at.z,
  189. right.x, top.x, back.x,
  190. right.y, top.y, back.y,
  191. right.z, top.z, back.z)
  192. end
  193.  
  194. function Triangle(a, b, c)
  195. local edg1 = (c-a):Dot((b-a).unit)
  196. local edg2 = (a-b):Dot((c-b).unit)
  197. local edg3 = (b-c):Dot((a-c).unit)
  198. if edg1 <= (b-a).magnitude and edg1 >= 0 then
  199. a, b, c = a, b, c
  200. elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
  201. a, b, c = b, c, a
  202. elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
  203. a, b, c = c, a, b
  204. else
  205. assert(false, "unreachable")
  206. end
  207.  
  208. local len1 = (c-a):Dot((b-a).unit)
  209. local len2 = (b-a).magnitude - len1
  210. local width = (a + (b-a).unit*len1 - c).magnitude
  211.  
  212. local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
  213.  
  214. local list = {}
  215.  
  216. local TrailColor = ("Dark grey")
  217.  
  218. if len1 > 0.01 then
  219. local w1 = Instance.new('WedgePart', m)
  220. game:GetService("Debris"):AddItem(w1,5)
  221. w1.Material = "SmoothPlastic"
  222. w1.FormFactor = 'Custom'
  223. w1.BrickColor = BrickColor.new(TrailColor)
  224. w1.Transparency = 0
  225. w1.Reflectance = 0
  226. w1.Material = "SmoothPlastic"
  227. w1.CanCollide = false
  228. NoOutline(w1)
  229. local sz = Vector3.new(0.2, width, len1)
  230. w1.Size = sz
  231. local sp = Instance.new("SpecialMesh",w1)
  232. sp.MeshType = "Wedge"
  233. sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
  234. w1:BreakJoints()
  235. w1.Anchored = true
  236. w1.Parent = workspace
  237. w1.Transparency = 0.7
  238. table.insert(Effects,{w1,"Disappear",.01})
  239. w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
  240. table.insert(list,w1)
  241. end
  242.  
  243. if len2 > 0.01 then
  244. local w2 = Instance.new('WedgePart', m)
  245. game:GetService("Debris"):AddItem(w2,5)
  246. w2.Material = "SmoothPlastic"
  247. w2.FormFactor = 'Custom'
  248. w2.BrickColor = BrickColor.new(TrailColor)
  249. w2.Transparency = 0
  250. w2.Reflectance = 0
  251. w2.Material = "SmoothPlastic"
  252. w2.CanCollide = false
  253. NoOutline(w2)
  254. local sz = Vector3.new(0.2, width, len2)
  255. w2.Size = sz
  256. local sp = Instance.new("SpecialMesh",w2)
  257. sp.MeshType = "Wedge"
  258. sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
  259. w2:BreakJoints()
  260. w2.Anchored = true
  261. w2.Parent = workspace
  262. w2.Transparency = 0.7
  263. table.insert(Effects,{w2,"Disappear",.01})
  264. w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
  265. table.insert(list,w2)
  266. end
  267. return unpack(list)
  268. end
  269.  
  270. function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  271. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  272. end
  273.  
  274. function clerp(a,b,t)
  275. local qa = {QuaternionFromCFrame(a)}
  276. local qb = {QuaternionFromCFrame(b)}
  277. local ax, ay, az = a.x, a.y, a.z
  278. local bx, by, bz = b.x, b.y, b.z
  279. local _t = 1-t
  280. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  281. end
  282.  
  283. function QuaternionFromCFrame(cf)
  284. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  285. local trace = m00 + m11 + m22
  286. if trace > 0 then
  287. local s = math.sqrt(1 + trace)
  288. local recip = 0.5/s
  289. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  290. else
  291. local i = 0
  292. if m11 > m00 then
  293. i = 1
  294. end
  295. if m22 > (i == 0 and m00 or m11) then
  296. i = 2
  297. end
  298. if i == 0 then
  299. local s = math.sqrt(m00-m11-m22+1)
  300. local recip = 0.5/s
  301. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  302. elseif i == 1 then
  303. local s = math.sqrt(m11-m22-m00+1)
  304. local recip = 0.5/s
  305. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  306. elseif i == 2 then
  307. local s = math.sqrt(m22-m00-m11+1)
  308. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  309. end
  310. end
  311. end
  312.  
  313. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  314. local xs, ys, zs = x + x, y + y, z + z
  315. local wx, wy, wz = w*xs, w*ys, w*zs
  316. local xx = x*xs
  317. local xy = x*ys
  318. local xz = x*zs
  319. local yy = y*ys
  320. local yz = y*zs
  321. local zz = z*zs
  322. 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))
  323. end
  324.  
  325. function QuaternionSlerp(a, b, t)
  326. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  327. local startInterp, finishInterp;
  328. if cosTheta >= 0.0001 then
  329. if (1 - cosTheta) > 0.0001 then
  330. local theta = math.acos(cosTheta)
  331. local invSinTheta = 1/math.sin(theta)
  332. startInterp = math.sin((1-t)*theta)*invSinTheta
  333. finishInterp = math.sin(t*theta)*invSinTheta
  334. else
  335. startInterp = 1-t
  336. finishInterp = t
  337. end
  338. else
  339. if (1+cosTheta) > 0.0001 then
  340. local theta = math.acos(-cosTheta)
  341. local invSinTheta = 1/math.sin(theta)
  342. startInterp = math.sin((t-1)*theta)*invSinTheta
  343. finishInterp = math.sin(t*theta)*invSinTheta
  344. else
  345. startInterp = t-1
  346. finishInterp = t
  347. end
  348. end
  349. 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
  350. end
  351.  
  352. sitting=false
  353. resting=false
  354. meditating=false
  355. sprint=false
  356.  
  357. mouse.Button1Down:connect(function()
  358. end)
  359. print'Only instinct left is survival.'
  360. mouse.KeyDown:connect(function(k)
  361. k=k:lower()
  362. if k=='z' and attack==false and resting==false and sprint==false and meditating==false then
  363. attack=true
  364. if sitting==false then
  365. sitting=true
  366. Humanoid.WalkSpeed = 0
  367. for i=0,1,0.04 do
  368. fat.Event:wait()
  369. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.25)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  370. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  371. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  372. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.3,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  373. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-60),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  374. LH.C0=clerp(LH.C0,cf(-0.75,0.25,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  375. end
  376. elseif sitting==true then
  377. sitting=false
  378. for i=0,1,0.04 do
  379. fat.Event:wait()
  380. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.25)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  381. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  382. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  383. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.3,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  384. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-60),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  385. LH.C0=clerp(LH.C0,cf(-0.75,0.25,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  386. end
  387. Humanoid.WalkSpeed = 3
  388. end
  389. attack=false
  390. end
  391. if k=='x' and attack==false and sitting==false and sprint==false and meditating==false then
  392. attack=true
  393. if resting==false then
  394. resting=true
  395. Humanoid.WalkSpeed = 0
  396. for i=0,1,0.04 do
  397. fat.Event:wait()
  398. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  399. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  400. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  401. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  402. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-40),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  403. LH.C0=clerp(LH.C0,cf(-0.75,0.05,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  404. end
  405. elseif resting==true then
  406. resting=false
  407. for i=0,1,0.04 do
  408. fat.Event:wait()
  409. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  410. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  411. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  412. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  413. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-40),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  414. LH.C0=clerp(LH.C0,cf(-0.75,0.05,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  415. end
  416. Humanoid.WalkSpeed = 3
  417. end
  418. attack=false
  419. end
  420. if k=='c' and attack==false and sitting==false and resting==false and sprint==false then
  421. attack=true
  422. if meditating==false then
  423. meditating=true
  424. Humanoid.WalkSpeed = 0
  425. for i=0,1,0.04 do
  426. fat.Event:wait()
  427. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  428. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  429. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  430. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  431. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-40),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  432. LH.C0=clerp(LH.C0,cf(-0.75,0.05,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  433. end
  434. elseif meditating==true then
  435. meditating=false
  436. for i=0,1,0.04 do
  437. fat.Event:wait()
  438. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  439. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  440. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  441. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  442. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-40),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  443. LH.C0=clerp(LH.C0,cf(-0.75,0.05,-1)*angles(math.rad(-15),math.rad(-90),math.rad(0))*angles(math.rad(-15),math.rad(0),math.rad(0)),0.15)
  444. end
  445. Humanoid.WalkSpeed = 3
  446. end
  447. attack=false
  448. end
  449. if k=='e' and attack==false and resting==false and sitting==false and meditating==false and sprint==false then
  450. sprint=true
  451. Humanoid.WalkSpeed = 16
  452. end
  453. end)
  454.  
  455. mouse.KeyUp:connect(function(k)
  456. if k=='e' and attack==false and resting==false and sitting==false and meditating==false and sprint==true then
  457. sprint=false
  458. Humanoid.WalkSpeed = 3
  459. end
  460. end)
  461.  
  462. local sine = 0
  463. local change = 1
  464. local val = 0
  465.  
  466. fat.Event:connect(function()
  467. sine = sine + change
  468. local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
  469. local velderp=RootPart.Velocity.y
  470. hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
  471. if equipped==true or equipped==false then
  472. if attack==false then
  473. idle=idle+1
  474. else
  475. idle=0
  476. end
  477. if idle>=500 then
  478. if attack==false then
  479. --Sheath()
  480. end
  481. end
  482. if RootPart.Velocity.y > 1 and hitfloor==nil then
  483. Anim="Jump"
  484. if attack==false then
  485. change=1
  486. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*angles(math.rad(-5),math.rad(0),math.rad(0)),0.15)
  487. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(-10),math.rad(0),math.rad(0)),0.15)
  488. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(-20),math.rad(0),math.rad(20)),0.15)
  489. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(-20),math.rad(0),math.rad(-20)),0.15)
  490. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(-20),math.rad(90),math.rad(0))*angles(math.rad(-10),math.rad(0),math.rad(0)),0.15)
  491. LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(-20),math.rad(-90),math.rad(0))*angles(math.rad(-10),math.rad(0),math.rad(0)),0.15)
  492. end
  493. elseif RootPart.Velocity.y < -1 and hitfloor==nil then
  494. Anim="Fall"
  495. if attack==false then
  496. change=1
  497. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*angles(math.rad(5),math.rad(0),math.rad(0)),0.15)
  498. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(10),math.rad(0),math.rad(0)),0.15)
  499. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(10),math.rad(0),math.rad(10)),0.15)
  500. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(10),math.rad(0),math.rad(-10)),0.15)
  501. RH.C0=clerp(RH.C0,cf(1,-1,0)*angles(math.rad(10),math.rad(90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(0)),0.15)
  502. LH.C0=clerp(LH.C0,cf(-1,-1,0)*angles(math.rad(-10),math.rad(-90),math.rad(0))*angles(math.rad(-5),math.rad(0),math.rad(0)),0.15)
  503. end
  504. elseif torvel<1 and hitfloor~=nil then
  505. Anim="Idle"
  506. if attack==false and sitting==false and resting==false and meditating==false then
  507. change=1
  508. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.1+0.1*math.cos(sine/30))*angles(math.rad(-2.5*math.cos(sine/30)),math.rad(0),math.rad(0)),0.15)
  509. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(-5*math.cos(sine/30))+ -math.sin(sine/30)/15,math.rad(0),math.rad(0)),0.15)
  510. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.55+0.05*math.cos(sine/30)+ -math.sin(sine/30)/40,0)*angles(math.rad(5-2.5*math.cos(sine/30)),math.rad(0),math.rad(10+5*math.cos(sine/30))+ math.sin(sine/30)/20),0.15)
  511. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.55+0.05*math.cos(sine/30)+ -math.sin(sine/30)/40,0)*angles(math.rad(5-2.5*math.cos(sine/30)),math.rad(0),math.rad(-10-5*math.cos(sine/30))+ -math.sin(sine/30)/20),0.15)
  512. RH.C0=clerp(RH.C0,cf(1,-0.9-0.1*math.cos(sine/30),0.025*math.cos(sine/30))*angles(math.rad(-2.5*math.cos(sine/30)),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  513. LH.C0=clerp(LH.C0,cf(-1,-0.9-0.1*math.cos(sine/30),0.025*math.cos(sine/30))*angles(math.rad(-2.5*math.cos(sine/30)),math.rad(-90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  514. else
  515. if attack==false and sitting==true and resting==false and meditating==false then
  516. change=1
  517. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.9)*angles(math.rad(-45-2.5*math.cos(sine/30)),math.rad(0),math.rad(0)),0.15)
  518. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(-5*math.cos(sine/30))+ -math.sin(sine/30)/15,math.rad(0),math.rad(0)),0.15)
  519. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.45,0)*angles(math.rad(-45-2.5*math.cos(sine/30)),math.rad(0),math.rad(10)),0.15)
  520. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.45,0)*angles(math.rad(-45-2.5*math.cos(sine/30)),math.rad(0),math.rad(-10)),0.15)
  521. RH.C0=clerp(RH.C0,cf(1,-1,0.025*math.cos(sine/30))*angles(math.rad(45-2.5*math.cos(sine/30)),math.rad(90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  522. LH.C0=clerp(LH.C0,cf(-1,-1,0.025*math.cos(sine/30))*angles(math.rad(45-2.5*math.cos(sine/30)),math.rad(-90),math.rad(0))*angles(math.rad(-2.5),math.rad(0),math.rad(0)),0.15)
  523. else
  524. if attack==false and sitting==false and resting==true and meditating==false then
  525. change=1
  526. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-2.3)*angles(math.rad(-80-1*math.cos(sine/30)),math.rad(0),math.rad(0)),0.15)
  527. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(5-1*math.cos(sine/30))+ -math.sin(sine/30)/15,math.rad(0),math.rad(0)),0.15)
  528. RW.C0=clerp(RW.C0,CFrame.new(1,0.75,0.1)*angles(math.rad(215-1*math.cos(sine/30)),math.rad(0),math.rad(-45)),0.15)
  529. LW.C0=clerp(LW.C0,CFrame.new(-1,0.75,0.1)*angles(math.rad(200-1*math.cos(sine/30)),math.rad(0),math.rad(45)),0.15)
  530. RH.C0=clerp(RH.C0,cf(1,-1,0.025*math.cos(sine/30))*angles(math.rad(25-1*math.cos(sine/30)),math.rad(90),math.rad(0))*angles(math.rad(20),math.rad(0),math.rad(0)),0.15)
  531. LH.C0=clerp(LH.C0,cf(-1,-1,0.025*math.cos(sine/30))*angles(math.rad(10-1*math.cos(sine/30)),math.rad(-90),math.rad(0))*angles(math.rad(20),math.rad(0),math.rad(0)),0.15)
  532. else
  533. if attack==false and sitting==false and resting==false and meditating==true then
  534. change=1
  535. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.9)*angles(math.rad(10-1*math.cos(sine/30)),math.rad(0),math.rad(0)),0.15)
  536. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(10-1*math.cos(sine/30))+ -math.sin(sine/30)/15,math.rad(0),math.rad(0)),0.15)
  537. RW.C0=clerp(RW.C0,CFrame.new(1.25,0.5,-0.5)*angles(math.rad(0),math.rad(165),math.rad(90)),0.15)
  538. LW.C0=clerp(LW.C0,CFrame.new(-1.25,0.5,-0.5)*angles(math.rad(0),math.rad(-165),math.rad(-90)),0.15)
  539. RH.C0=clerp(RH.C0,cf(1,-1,0.1)*angles(math.rad(-30),math.rad(75),math.rad(0))*angles(math.rad(80),math.rad(0),math.rad(0)),0.15)
  540. LH.C0=clerp(LH.C0,cf(-1,-1,0.1)*angles(math.rad(-30),math.rad(-75),math.rad(0))*angles(math.rad(80),math.rad(0),math.rad(0)),0.15)
  541. end
  542. end
  543. end
  544. end
  545. elseif torvel>2 and torvel<22 and hitfloor~=nil then
  546. Anim="Walk"
  547. if attack==false and sprint==false then
  548. change=0.5
  549. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.175+0.025*math.cos(sine/3.5)+ -math.sin(sine/3.5)/7)*angles(math.rad(5-2.5*math.cos(sine/3.5)),math.rad(0),math.rad(10*math.cos(sine/7))),0.15)
  550. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0+0.025*math.cos(sine/3.5))*angles(math.rad(0-2.5*math.cos(sine/3.5)),math.rad(1.5*math.cos(sine/7)),math.rad(-7.5*math.cos(sine/7))),0.15)
  551. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(30*math.cos(sine/7))+ math.sin(sine/7)/2.5,math.rad(0),math.rad(10)),0.15)
  552. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(-30*math.cos(sine/7))+ -math.sin(sine/7)/2.5,math.rad(0),math.rad(-10)),0.15)
  553. RH.C0=clerp(RH.C0,cf(1,-0.925-0.5*math.cos(sine/7)/2,0.5*math.cos(sine/7)/2)*angles(math.rad(-15-15*math.cos(sine/7))+ -math.sin(sine/7)/2.5,math.rad(90-10*math.cos(sine/7)),math.rad(0))*angles(math.rad(0+2.5*math.cos(sine/7)),math.rad(0),math.rad(0)),0.15)
  554. LH.C0=clerp(LH.C0,cf(-1,-0.925+0.5*math.cos(sine/7)/2,-0.5*math.cos(sine/7)/2)*angles(math.rad(-15+15*math.cos(sine/7))+ math.sin(sine/7)/2.5,math.rad(-90-10*math.cos(sine/7)),math.rad(0))*angles(math.rad(0-2.5*math.cos(sine/7)),math.rad(0),math.rad(0)),0.15)
  555. elseif attack==false and sprint==true then
  556. change=1
  557. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-0.1+0.1*math.cos(sine/3.5)+ -math.sin(sine/3.5)/7)*angles(math.rad(5-2.5*math.cos(sine/3.5)),math.rad(0),math.rad(10*math.cos(sine/7))),0.15)
  558. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0+0.025*math.cos(sine/3.5))*angles(math.rad(0-2.5*math.cos(sine/3.5)),math.rad(1.5*math.cos(sine/7)),math.rad(-7.5*math.cos(sine/7))),0.15)
  559. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(45*math.cos(sine/7))+ math.sin(sine/7)/2.5,math.rad(0),math.rad(10)),0.15)
  560. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(-45*math.cos(sine/7))+ -math.sin(sine/7)/2.5,math.rad(0),math.rad(-10)),0.15)
  561. RH.C0=clerp(RH.C0,cf(1,-0.9-0.25*math.cos(sine/7)/2,0.5*math.cos(sine/7)/2)*angles(math.rad(-15-45*math.cos(sine/7))+ -math.sin(sine/7)/2.5,math.rad(90-10*math.cos(sine/7)),math.rad(0))*angles(math.rad(0+2.5*math.cos(sine/7)),math.rad(0),math.rad(0)),0.15)
  562. LH.C0=clerp(LH.C0,cf(-1,-0.9+0.25*math.cos(sine/7)/2,-0.5*math.cos(sine/7)/2)*angles(math.rad(-15+45*math.cos(sine/7))+ math.sin(sine/7)/2.5,math.rad(-90-10*math.cos(sine/7)),math.rad(0))*angles(math.rad(0-2.5*math.cos(sine/7)),math.rad(0),math.rad(0)),0.15)
  563. end
  564. elseif torvel<22 and hitfloor~=nil then
  565. Anim="Run"
  566. if attack==false then
  567. end
  568. end
  569. end
  570. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement