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