Znimator

Untitled

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