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