Advertisement
cat568

Untitled

Dec 22nd, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --just put this on the top of a script and boom 89% works
  2. --note this does not work on big scripts
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,game,owner = owner,game
  5. local RealPlayer = Player
  6. do
  7. local rp = RealPlayer
  8. script.Parent = rp.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent then
  34. for _,f in pairs(t.Functions) do
  35. f(...)
  36. end
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=rp then return end
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. if not io.isMouse then
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. for _,t in pairs(CAS.Actions) do
  52. for _,k in pairs(t.Keys) do
  53. if k==io.KeyCode then
  54. t.Function(t.Name,io.UserInputState,io)
  55. end
  56. end
  57. end
  58. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  59. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  60. end
  61. end)
  62. Event.Parent = NLS([==[
  63. local Player = game:GetService("Players").LocalPlayer
  64. local Event = script:WaitForChild("UserInput_Event")
  65.  
  66. local Mouse = Player:GetMouse()
  67. local UIS = game:GetService("UserInputService")
  68. local input = function(io,a)
  69. if a then return end
  70. --Since InputObject is a client-side instance, we create and pass table instead
  71. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  72. end
  73. UIS.InputBegan:Connect(input)
  74. UIS.InputEnded:Connect(input)
  75.  
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then return s[k] end
  95. end,
  96. __newindex = function(self,k,v)
  97. local s = rawget(self,"_RealService")
  98. if s then s[k]=v end
  99. end,
  100. __call = function(self,...)
  101. local s = rawget(self,"_RealService")
  102. if s then return s(...) end
  103. end
  104. }
  105. local function FakeService(t,RealService)
  106. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  107. return setmetatable(t,fsmt)
  108. end
  109.  
  110. --Fake game object
  111. local g = {
  112. GetService = function(self,s)
  113. return self[s]
  114. end,
  115. Players = FakeService({
  116. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  117. },"Players"),
  118. UserInputService = FakeService(UIS,"UserInputService"),
  119. ContextActionService = FakeService(CAS,"ContextActionService"),
  120. }
  121. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  122. g.service = g.GetService
  123.  
  124. g.RunService = FakeService({
  125. RenderStepped = _rg:GetService("RunService").Heartbeat,
  126. BindToRenderStep = function(self,name,_,fun)
  127. self._btrs[name] = self.Heartbeat:Connect(fun)
  128. end,
  129. UnbindFromRenderStep = function(self,name)
  130. self._btrs[name]:Disconnect()
  131. end,
  132. },"RunService")
  133.  
  134. setmetatable(g,{
  135. __index=function(self,s)
  136. return _rg:GetService(s) or typeof(_rg[s])=="function"
  137. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  138. end,
  139. __newindex = fsmt.__newindex,
  140. __call = fsmt.__call
  141. })
  142. --Changing owner to fake player object to support owner:GetMouse()
  143. game,owner = g,g.Players.LocalPlayer
  144. end
  145.  
  146.  
  147.  
  148. --[[Pacifist class created by Brannon1964802.]]--
  149.  
  150. Player=game:GetService("Players").LocalPlayer
  151. Character=Player.Character
  152. PlayerGui=Player.PlayerGui
  153. Backpack=Player.Backpack
  154. Torso=Character.Torso
  155. Head=Character.Head
  156. Humanoid=Character.Humanoid
  157. m=Instance.new('Model',Character)
  158. LeftArm=Character["Left Arm"]
  159. LeftLeg=Character["Left Leg"]
  160. RightArm=Character["Right Arm"]
  161. RightLeg=Character["Right Leg"]
  162. LS=Torso["Left Shoulder"]
  163. LH=Torso["Left Hip"]
  164. RS=Torso["Right Shoulder"]
  165. RH=Torso["Right Hip"]
  166. Face = Head.face
  167. Neck=Torso.Neck
  168. --it=Instance.new
  169. attacktype=1
  170. vt=Vector3.new
  171. cf=CFrame.new
  172. euler=CFrame.fromEulerAnglesXYZ
  173. angles=CFrame.Angles
  174. cloaked=false
  175. necko=cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  176. necko2=cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  177. LHC0=cf(-1,-1,0,-0,-0,-1,0,1,0,1,0,0)
  178. LHC1=cf(-0.5,1,0,-0,-0,-1,0,1,0,1,0,0)
  179. RHC0=cf(1,-1,0,0,0,1,0,1,0,-1,-0,-0)
  180. RHC1=cf(0.5,1,0,0,0,1,0,1,0,-1,-0,-0)
  181. RootPart=Character.HumanoidRootPart
  182. RootJoint=RootPart.RootJoint
  183. RootCF=euler(-1.57,0,3.14)
  184. attack = false
  185. attackdebounce = false
  186. deb=false
  187. equipped=true
  188. hand=false
  189. MMouse=nil
  190. combo=0
  191. mana=0
  192. trispeed=.2
  193. attackmode='none'
  194. local idle=0
  195. local Anim="Idle"
  196. local gun=false
  197. local shoot=false
  198. player=nil
  199. mana=0
  200.  
  201. local defensevalue = .3
  202. local speedvalue = 1
  203. local damagevalue = 1
  204. local cf = CFrame.new-- make things easier :)
  205. local mr = math.rad
  206. local angles = CFrame.Angles
  207. local ud = UDim2.new
  208. local c3 = Color3.new
  209.  
  210. local stats=Instance.new('Folder',Character)
  211. stats.Name='Stats'
  212. local block=Instance.new('BoolValue',stats)
  213. block.Name='Block'
  214. block.Value=false
  215. local stun=Instance.new('BoolValue',stats)
  216. stun.Name='Stun'
  217. stun.Value=false
  218. local defense=Instance.new('NumberValue',stats)
  219. defense.Name='Defence'
  220. defense.Value=defensevalue
  221. local speed=Instance.new('NumberValue',stats)
  222. speed.Name='Speed'
  223. speed.Value=speedvalue
  224. local damagea=Instance.new('NumberValue',stats)
  225. damagea.Name='Damage'
  226. damagea.Value=damagevalue
  227.  
  228. Humanoid = Character.Humanoid
  229. if Humanoid:FindFirstChild("Animator")then
  230. Humanoid:FindFirstChild("Animator"):Destroy()
  231. end
  232.  
  233. Humanoid.WalkSpeed = 3
  234.  
  235. music = Instance.new("Sound", Torso)
  236. music.SoundId = "http://www.roblox.com/asset/?id=2670532439"
  237. music.Volume = 0.5
  238. music.PlayBackSpeed = 0.015625
  239. music.Looped = true
  240. wait(0.1)
  241. music:Play()
  242.  
  243. Colorpart1 = Torso.BrickColor.r
  244. Colorpart2 = Torso.BrickColor.g
  245. Colorpart3 = Torso.BrickColor.b
  246.  
  247. CloakEffectLight2 = Instance.new("PointLight", Torso)
  248. CloakEffectLight2.Color = Color3.new(Colorpart1, Colorpart2, Colorpart3)
  249. CloakEffectLight2.Range = 7.5
  250. CloakEffectLight2.Brightness = 7.5
  251. CloakEffectLight2.Enabled = true
  252.  
  253. mouse=Player:GetMouse()
  254. --save shoulders
  255. RSH, LSH=nil, nil
  256. --welds
  257. RW, LW=Instance.new("Motor"), Instance.new("Motor")
  258. RW.Name="Right Shoulder" LW.Name="Left Shoulder"
  259. LH=Torso["Left Hip"]
  260. RH=Torso["Right Hip"]
  261. TorsoColor=Torso.BrickColor
  262. function NoOutline(Part)
  263. Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface = 10,10,10,10,10,10
  264. end
  265. player=Player
  266. ch=Character
  267. RSH=ch.Torso["Right Shoulder"]
  268. LSH=ch.Torso["Left Shoulder"]
  269. --
  270. RSH.Parent=nil
  271. LSH.Parent=nil
  272. --
  273. RW.Name="Right Shoulder"
  274. RW.Part0=ch.Torso
  275. RW.C0=cf(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
  276. RW.C1=cf(0, 0.5, 0)
  277. RW.Part1=ch["Right Arm"]
  278. RW.Parent=ch.Torso
  279. --
  280. LW.Name="Left Shoulder"
  281. LW.Part0=ch.Torso
  282. LW.C0=cf(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
  283. LW.C1=cf(0, 0.5, 0)
  284. LW.Part1=ch["Left Arm"]
  285. LW.Parent=ch.Torso
  286.  
  287. local function weldBetween(a, b)
  288. local weldd = Instance.new("ManualWeld")
  289. weldd.Part0 = a
  290. weldd.Part1 = b
  291. weldd.C0 = CFrame.new()
  292. weldd.C1 = b.CFrame:inverse() * a.CFrame
  293. weldd.Parent = a
  294. return weldd
  295. end
  296.  
  297. fat = Instance.new("BindableEvent", script)
  298. fat.Name = "Heartbeat"
  299.  
  300. script:WaitForChild("Heartbeat")
  301.  
  302. frame = 1 / 30
  303. tf = 0
  304. 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.
  305. tossremainder = false --if set to true t will be set to 0 after Fire()-ing.
  306. lastframe = tick()
  307. script.Heartbeat:Fire() --ayy lmao
  308.  
  309. game:GetService("RunService").Heartbeat:connect(function(s, p) --herp derp
  310. tf = tf + s
  311. if tf >= frame then
  312. if allowframeloss then
  313. script.Heartbeat:Fire()
  314. lastframe = tick()
  315. else
  316. --print("FIRED "..math.floor(t/frame).." FRAME(S)","REMAINDER "..(t - frame*(math.floor(t/frame))))
  317. for i = 1, math.floor(tf / frame) do
  318. script.Heartbeat:Fire()
  319. end
  320. lastframe = tick()
  321. end
  322. if tossremainder then
  323. tf = 0
  324. else
  325. tf = tf - frame * math.floor(tf / frame)
  326. end
  327. end
  328. end)
  329.  
  330. --To use: fat.Event:fat.Event:wait() or fat.Event:connect(function() asdcode end)
  331.  
  332. local function CFrameFromTopBack(at, top, back)
  333. local right = top:Cross(back)
  334. return CFrame.new(at.x, at.y, at.z,
  335. right.x, top.x, back.x,
  336. right.y, top.y, back.y,
  337. right.z, top.z, back.z)
  338. end
  339.  
  340. function Triangle(a, b, c)
  341. local edg1 = (c-a):Dot((b-a).unit)
  342. local edg2 = (a-b):Dot((c-b).unit)
  343. local edg3 = (b-c):Dot((a-c).unit)
  344. if edg1 <= (b-a).magnitude and edg1 >= 0 then
  345. a, b, c = a, b, c
  346. elseif edg2 <= (c-b).magnitude and edg2 >= 0 then
  347. a, b, c = b, c, a
  348. elseif edg3 <= (a-c).magnitude and edg3 >= 0 then
  349. a, b, c = c, a, b
  350. else
  351. assert(false, "unreachable")
  352. end
  353.  
  354. local len1 = (c-a):Dot((b-a).unit)
  355. local len2 = (b-a).magnitude - len1
  356. local width = (a + (b-a).unit*len1 - c).magnitude
  357.  
  358. local maincf = CFrameFromTopBack(a, (b-a):Cross(c-b).unit, -(b-a).unit)
  359.  
  360. local list = {}
  361.  
  362. local TrailColor = ("Dark grey")
  363.  
  364. if len1 > 0.01 then
  365. local w1 = Instance.new('WedgePart', m)
  366. game:GetService("Debris"):AddItem(w1,5)
  367. w1.Material = "SmoothPlastic"
  368. w1.FormFactor = 'Custom'
  369. w1.BrickColor = BrickColor.new(TrailColor)
  370. w1.Transparency = 0
  371. w1.Reflectance = 0
  372. w1.Material = "SmoothPlastic"
  373. w1.CanCollide = false
  374. NoOutline(w1)
  375. local sz = Vector3.new(0.2, width, len1)
  376. w1.Size = sz
  377. local sp = Instance.new("SpecialMesh",w1)
  378. sp.MeshType = "Wedge"
  379. sp.Scale = Vector3.new(0,1,1) * sz/w1.Size
  380. w1:BreakJoints()
  381. w1.Anchored = true
  382. w1.Parent = workspace
  383. w1.Transparency = 0.7
  384. table.insert(Effects,{w1,"Disappear",.01})
  385. w1.CFrame = maincf*CFrame.Angles(math.pi,0,math.pi/2)*CFrame.new(0,width/2,len1/2)
  386. table.insert(list,w1)
  387. end
  388.  
  389. if len2 > 0.01 then
  390. local w2 = Instance.new('WedgePart', m)
  391. game:GetService("Debris"):AddItem(w2,5)
  392. w2.Material = "SmoothPlastic"
  393. w2.FormFactor = 'Custom'
  394. w2.BrickColor = BrickColor.new(TrailColor)
  395. w2.Transparency = 0
  396. w2.Reflectance = 0
  397. w2.Material = "SmoothPlastic"
  398. w2.CanCollide = false
  399. NoOutline(w2)
  400. local sz = Vector3.new(0.2, width, len2)
  401. w2.Size = sz
  402. local sp = Instance.new("SpecialMesh",w2)
  403. sp.MeshType = "Wedge"
  404. sp.Scale = Vector3.new(0,1,1) * sz/w2.Size
  405. w2:BreakJoints()
  406. w2.Anchored = true
  407. w2.Parent = workspace
  408. w2.Transparency = 0.7
  409. table.insert(Effects,{w2,"Disappear",.01})
  410. w2.CFrame = maincf*CFrame.Angles(math.pi,math.pi,-math.pi/2)*CFrame.new(0,width/2,-len1 - len2/2)
  411. table.insert(list,w2)
  412. end
  413. return unpack(list)
  414. end
  415.  
  416. function rayCast(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  417. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  418. end
  419.  
  420. function clerp(a,b,t)
  421. local qa = {QuaternionFromCFrame(a)}
  422. local qb = {QuaternionFromCFrame(b)}
  423. local ax, ay, az = a.x, a.y, a.z
  424. local bx, by, bz = b.x, b.y, b.z
  425. local _t = 1-t
  426. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  427. end
  428.  
  429. function QuaternionFromCFrame(cf)
  430. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  431. local trace = m00 + m11 + m22
  432. if trace > 0 then
  433. local s = math.sqrt(1 + trace)
  434. local recip = 0.5/s
  435. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  436. else
  437. local i = 0
  438. if m11 > m00 then
  439. i = 1
  440. end
  441. if m22 > (i == 0 and m00 or m11) then
  442. i = 2
  443. end
  444. if i == 0 then
  445. local s = math.sqrt(m00-m11-m22+1)
  446. local recip = 0.5/s
  447. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  448. elseif i == 1 then
  449. local s = math.sqrt(m11-m22-m00+1)
  450. local recip = 0.5/s
  451. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  452. elseif i == 2 then
  453. local s = math.sqrt(m22-m00-m11+1)
  454. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  455. end
  456. end
  457. end
  458.  
  459. function QuaternionToCFrame(px, py, pz, x, y, z, w)
  460. local xs, ys, zs = x + x, y + y, z + z
  461. local wx, wy, wz = w*xs, w*ys, w*zs
  462. local xx = x*xs
  463. local xy = x*ys
  464. local xz = x*zs
  465. local yy = y*ys
  466. local yz = y*zs
  467. local zz = z*zs
  468. 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))
  469. end
  470.  
  471. function QuaternionSlerp(a, b, t)
  472. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  473. local startInterp, finishInterp;
  474. if cosTheta >= 0.0001 then
  475. if (1 - cosTheta) > 0.0001 then
  476. local theta = math.acos(cosTheta)
  477. local invSinTheta = 1/math.sin(theta)
  478. startInterp = math.sin((1-t)*theta)*invSinTheta
  479. finishInterp = math.sin(t*theta)*invSinTheta
  480. else
  481. startInterp = 1-t
  482. finishInterp = t
  483. end
  484. else
  485. if (1+cosTheta) > 0.0001 then
  486. local theta = math.acos(-cosTheta)
  487. local invSinTheta = 1/math.sin(theta)
  488. startInterp = math.sin((t-1)*theta)*invSinTheta
  489. finishInterp = math.sin(t*theta)*invSinTheta
  490. else
  491. startInterp = t-1
  492. finishInterp = t
  493. end
  494. end
  495. 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
  496. end
  497.  
  498. sitting=false
  499. resting=false
  500. meditating=false
  501. sprint=false
  502.  
  503. mouse.Button1Down:connect(function()
  504. end)
  505. print'Only instinct left is survival.'
  506. mouse.KeyDown:connect(function(k)
  507. k=k:lower()
  508. if k=='z' and attack==false and resting==false and sprint==false and meditating==false then
  509. attack=true
  510. if sitting==false then
  511. sitting=true
  512. Humanoid.WalkSpeed = 0
  513. for i=0,1,0.04 do
  514. fat.Event:wait()
  515. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.25)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  516. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  517. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  518. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.3,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  519. 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)
  520. 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)
  521. end
  522. elseif sitting==true then
  523. sitting=false
  524. for i=0,1,0.04 do
  525. fat.Event:wait()
  526. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.25)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  527. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  528. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  529. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.3,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  530. 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)
  531. 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)
  532. end
  533. Humanoid.WalkSpeed = 3
  534. end
  535. attack=false
  536. end
  537. if k=='x' and attack==false and sitting==false and sprint==false and meditating==false then
  538. attack=true
  539. if resting==false then
  540. resting=true
  541. Humanoid.WalkSpeed = 0
  542. for i=0,1,0.04 do
  543. fat.Event:wait()
  544. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  545. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  546. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  547. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  548. 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)
  549. 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)
  550. end
  551. elseif resting==true then
  552. resting=false
  553. for i=0,1,0.04 do
  554. fat.Event:wait()
  555. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  556. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  557. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  558. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  559. 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)
  560. 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)
  561. end
  562. Humanoid.WalkSpeed = 3
  563. end
  564. attack=false
  565. end
  566. if k=='c' and attack==false and sitting==false and resting==false and sprint==false then
  567. attack=true
  568. if meditating==false then
  569. meditating=true
  570. Humanoid.WalkSpeed = 0
  571. for i=0,1,0.04 do
  572. fat.Event:wait()
  573. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  574. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  575. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  576. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  577. 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)
  578. 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)
  579. end
  580. elseif meditating==true then
  581. meditating=false
  582. for i=0,1,0.04 do
  583. fat.Event:wait()
  584. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,-1.05)*angles(math.rad(0),math.rad(15),math.rad(0)),0.15)
  585. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(20),math.rad(0),math.rad(30)),0.15)
  586. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(0),math.rad(0),math.rad(20)),0.15)
  587. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.1,0)*angles(math.rad(15),math.rad(0),math.rad(-25)),0.15)
  588. 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)
  589. 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)
  590. end
  591. Humanoid.WalkSpeed = 3
  592. end
  593. attack=false
  594. end
  595. if k=='e' and attack==false and resting==false and sitting==false and meditating==false and sprint==false then
  596. sprint=true
  597. Humanoid.WalkSpeed = 16
  598. end
  599. end)
  600.  
  601. mouse.KeyUp:connect(function(k)
  602. if k=='e' and attack==false and resting==false and sitting==false and meditating==false and sprint==true then
  603. sprint=false
  604. Humanoid.WalkSpeed = 3
  605. end
  606. end)
  607.  
  608. local sine = 0
  609. local change = 1
  610. local val = 0
  611.  
  612. fat.Event:connect(function()
  613. sine = sine + change
  614. local torvel=(RootPart.Velocity*Vector3.new(1,0,1)).magnitude
  615. local velderp=RootPart.Velocity.y
  616. hitfloor,posfloor=rayCast(RootPart.Position,(CFrame.new(RootPart.Position,RootPart.Position - Vector3.new(0,1,0))).lookVector,4,Character)
  617. if equipped==true or equipped==false then
  618. if attack==false then
  619. idle=idle+1
  620. else
  621. idle=0
  622. end
  623. if idle>=500 then
  624. if attack==false then
  625. --Sheath()
  626. end
  627. end
  628. if RootPart.Velocity.y > 1 and hitfloor==nil then
  629. Anim="Jump"
  630. if attack==false then
  631. change=1
  632. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*angles(math.rad(-5),math.rad(0),math.rad(0)),0.15)
  633. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(-10),math.rad(0),math.rad(0)),0.15)
  634. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(-20),math.rad(0),math.rad(20)),0.15)
  635. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(-20),math.rad(0),math.rad(-20)),0.15)
  636. 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)
  637. 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)
  638. end
  639. elseif RootPart.Velocity.y < -1 and hitfloor==nil then
  640. Anim="Fall"
  641. if attack==false then
  642. change=1
  643. RootJoint.C0=clerp(RootJoint.C0,RootCF*cf(0,0,0)*angles(math.rad(5),math.rad(0),math.rad(0)),0.15)
  644. Torso.Neck.C0=clerp(Torso.Neck.C0,necko*cf(0,0,0)*angles(math.rad(10),math.rad(0),math.rad(0)),0.15)
  645. RW.C0=clerp(RW.C0,CFrame.new(1.5,0.5,0)*angles(math.rad(10),math.rad(0),math.rad(10)),0.15)
  646. LW.C0=clerp(LW.C0,CFrame.new(-1.5,0.5,0)*angles(math.rad(10),math.rad(0),math.rad(-10)),0.15)
  647. 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)
  648. 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)
  649. end
  650. elseif torvel<1 and hitfloor~=nil then
  651. Anim="Idle"
  652. if attack==false and sitting==false and resting==false and meditating==false then
  653. change=1
  654. 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)
  655. 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)
  656. 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)
  657. 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)
  658. 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)
  659. 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)
  660. else
  661. if attack==false and sitting==true and resting==false and meditating==false then
  662. change=1
  663. 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)
  664. 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)
  665. 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)
  666. 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)
  667. 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)
  668. 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)
  669. else
  670. if attack==false and sitting==false and resting==true and meditating==false then
  671. change=1
  672. 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)
  673. 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)
  674. 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)
  675. 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)
  676. 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)
  677. 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)
  678. else
  679. if attack==false and sitting==false and resting==false and meditating==true then
  680. change=1
  681. 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)
  682. 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)
  683. 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)
  684. 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)
  685. 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)
  686. 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)
  687. end
  688. end
  689. end
  690. end
  691. elseif torvel>2 and torvel<22 and hitfloor~=nil then
  692. Anim="Walk"
  693. if attack==false and sprint==false then
  694. change=0.5
  695. 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)
  696. 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)
  697. 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)
  698. 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)
  699. 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)
  700. 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)
  701. elseif attack==false and sprint==true then
  702. change=1
  703. 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)
  704. 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)
  705. 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)
  706. 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)
  707. 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)
  708. 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)
  709. end
  710. elseif torvel<22 and hitfloor~=nil then
  711. Anim="Run"
  712. if attack==false then
  713. end
  714. end
  715. end
  716. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement