View difference between Paste ID: M4A1xe1Q and QkgKJyhd
SHOW: | | - or go back to the newest paste.
1
local player = game.Players.LocalPlayer 
2
local character = player.Character
3
local mse = player:GetMouse()
4
local cf = CFrame.new
5
local angles = CFrame.Angles
6
local euler = CFrame.fromEulerAnglesXYZ
7
local necko = cf(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
8
local necko2 = cf(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
9
local properties = {     
10
	mesh = "rbxassetid://430991742"; -- MeshID for the knife     
11
	texture = "rbxassetid://430991793"; -- TextureID for knife     
12
	scale = Vector3.new(0.3,0.3,0.3); -- Knife scale     
13
	gore = true; -- Blood or nah 
14
}
15
local equipping2 = false
16
local sound = Instance.new("Sound", character.Torso)
17-
sound.SoundId = "rbxassetid://392118640"
17+
sound.SoundId = "rbxassetid://651288097"
18-
sound.Volume = 1
18+
sound.Volume = 10
19
sound.Looped = true
20
sound.Pitch = 0.85
21
sound:Play()
22
local knife = Instance.new("Part", character) 
23
knife.Locked = true 
24
knife.Name ="Knife" 
25
knife.CanCollide = false 
26
knife.CFrame = character.Torso.CFrame
27
knife.Size = Vector3.new(2.4,1,1) 
28
local sbox = Instance.new("SelectionBox",knife)
29
sbox.Adornee=knife
30
sbox.Transparency = 1
31
local mesh = Instance.new("SpecialMesh",knife) 
32
mesh.MeshType = Enum.MeshType.FileMesh 
33
mesh.TextureId = properties.texture 
34
mesh.MeshId = properties.mesh mesh.Scale = properties.scale
35
local holder = Instance.new("Part",character)
36
holder.BrickColor = BrickColor.new("Brown")
37
holder.TopSurface,holder.BottomSurface = "SmoothNoOutlines" ,"SmoothNoOutlines"
38
holder.Size = Vector3.new(.2,2,.6)
39
holder.CanCollide = false
40
local knifweld = Instance.new("Weld",character) 
41
knifweld.Part1 = holder
42
knifweld.Part0 = knife 
43
knifweld.C0 = CFrame.new(-.3,0,0) * CFrame.Angles(math.rad(90),0,math.rad(-90))
44
local holderweld = Instance.new("Weld",character)
45
holderweld.Part0 = holder
46
holderweld.Part1 = character['Left Leg']
47
holderweld.C0 = CFrame.new(0.5,-0.5,-0.5) * CFrame.Angles(math.rad(50),0,0)
48
local RbxUtility = LoadLibrary("RbxUtility")
49
local Create = RbxUtility.Create
50
local equipped = false
51
local LeftArm=character['Left Arm']
52
local RightArm = character['Right Arm']
53
local LeftLeg = character['Left Leg']
54
local RightLeg = character['Right Leg']
55
local Torso = character['Torso']
56
RS = Create("Weld"){
57
	Name = "Right Shoulder",
58
	Part0 = Torso ,
59
	C0 = cf(1.5, 0.5, 0),
60
	C1 = cf(0, 0.5, 0), 
61
	Part1 = RightArm ,
62
	Parent = Torso ,
63
}
64
65
LS = Create("Weld"){
66
	Name = "Left Shoulder",
67
	Part0 = Torso ,
68
	C0 = cf(-1.5, 0.5, 0),
69
	C1 = cf(0, 0.5, 0) ,
70
	Part1 = LeftArm ,
71
	Parent = Torso ,
72
}
73
74
RH = Create("Weld"){
75
	Part0 = Torso, 
76
	C0 = cf(0, -1.5, 0), --* euler(1.3, 0, -0.5) 
77
	C1 = cf(-0.5, 0.5, 0) ,
78
	Part1 = character["Right Leg"], 	
79
	Parent = Torso,	
80
}
81
82
LH = Create("Weld"){
83
	Part0 = Torso, 
84
	C0 = cf(0, -1.5, 0), --* euler(1.3, 0, -0.5) 
85
	C1 = cf(0.5, 0.5, 0) ,
86
	Part1 = character["Left Leg"], 
87
	Parent = Torso,
88
}
89
90
local Nek = Instance.new("Weld",character.Torso)
91
Nek.Name = "Neck"
92
Nek.Part0 = character.Torso['Neck'].Part0
93
Nek.Part1 = character.Torso['Neck'].Part1
94
Nek.C0 = character.Torso['Neck'].C0
95
Nek.C1 = character.Torso['Neck'].C1
96
97
local ActiveAnim = "Idle"
98
99
function rayCast(Pos, Dir, Max, Ignore)
100
	return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore) 
101
end 
102
local RootPart = character.HumanoidRootPart
103
104
function swait(num)
105
	if num ~= nil and num > 0 then
106
		return game:service'RunService'.RenderStepped:wait(num)
107
	else
108
		return game:service'RunService'.RenderStepped:wait(0)
109
	end
110
end
111
112
local sine=0
113
local change=1
114
local val=0
115
local idle=0
116
local donum=0
117
local handidle=false
118
local equipping = false
119
local attacking = false
120
local Keys = {}
121
local Humanoid = character:WaitForChild"Humanoid"
122
local equippingDebounce = false
123
mse.KeyDown:connect(function(k)
124
	Keys[tostring(string.byte(k))] = true
125
	if k == "e" and equippingDebounce == false and not attacking and ActiveAnim ~= "Run"  then
126
		equipping = true
127
		equipping2 = true
128
		equippingDebounce = true
129
		wait(.1)
130
		for i = 0,1,.1 do
131
			RS.C0 = clerp(RS.C0,cf(0.6,0.5,-0.7)*angles(math.rad(45),math.rad(25),math.rad(-75)),.2)
132
			swait()
133
		end
134
		wait(.1)
135
		if not equipped then
136
			knifweld.Part1 = character['Right Arm'] 
137
			knifweld.C0 = CFrame.new(1,1,0)*CFrame.Angles(0,math.rad(90),0)
138
		else
139
			knifweld.Part1 = holder
140
			knifweld.C0 = CFrame.new(-.3,0,0) * CFrame.Angles(math.rad(90),0,math.rad(-90))
141
		end
142
		equipped = not equipped
143
		equipping = false
144
		Humanoid.WalkSpeed = 24
145
		Humanoid.JumpPower = 50
146
		equipping2 = false
147
		wait(.2)
148
		equippingDebounce = false
149
	end
150
end)
151
mse.KeyUp:connect(function(k)
152
	Keys[tostring(string.byte(k))] = nil
153
end)
154
155
Blood = function(Part,Num)
156
	for i = 1, Num do
157
		local b = Create("Part"){
158
			Name = "Blood",
159
			Parent = workspace,
160
			BrickColor = BrickColor.new("Crimson"),
161
			Material = "Plastic",
162
			Size = Vector3.new(.2,.2,.2),
163
			Transparency = 0.7,
164
			Velocity = Vector3.new(math.random(-3,3),2,math.random(-3,3)),
165
			CanCollide = false,
166
			Locked = true,
167
			CFrame = Part.CFrame*CFrame.new(math.random(-3,3),math.random(0,2),math.random(-3,3))
168
		}
169
		game:service'Debris':AddItem(b,1)
170
	end
171
end
172
173
Damagefunc = function(Part, hit, minim, maxim, knockback, Type, Property, Delay, HitSound, HitPitch)
174
	if hit.Parent == nil then
175
		return
176
	end
177
	local h = hit.Parent:FindFirstChild("Humanoid")
178
	for _, v in pairs(hit.Parent:children()) do
179
		if v:IsA("Humanoid") then
180
			h = v
181
		end
182
	end
183
	if h ~= nil and hit.Parent.Name ~= character.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
184
		if hit.Parent:findFirstChild("DebounceHit") ~= nil then
185
			if hit.Parent.DebounceHit.Value == true then
186
				return
187
			end
188
		end
189
		if h.MaxHealth >= math.huge then
190
			hit:BreakJoints()
191
		end
192
		local c = Create("ObjectValue"){
193
			Name = "creator",
194
			Value = game:service("Players").LocalPlayer,
195
			Parent = h,
196
		}
197
		game:GetService("Debris"):AddItem(c, .5)
198
		local Damage = math.random(minim, maxim)
199
		local blocked = false
200
		local block = hit.Parent:findFirstChild("Block")
201
		if block ~= nil then
202
			if block.className == "IntValue" then
203
				if block.Value > 0 then
204
					blocked = true
205
					block.Value = block.Value - 1
206
					print(block.Value)
207
				end
208
			end
209
		end
210
		if blocked == false then
211
			if h.Health > 0 then
212
				Blood(hit,7)
213
			end
214
			h.Health = h.Health - Damage
215
			--ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Crimson").Color, BrickColor.new("Crimson").Color)
216
		else
217
			if h.Health > 0 then
218
				Blood(hit,7)
219
			end
220
			h.Health = h.Health - (Damage*2)
221
			--ShowDamage((Part.CFrame * CFrame.new(0, 0, (Part.Size.Z / 2)).p + Vector3.new(0, 1.5, 0)), -Damage, 1.5, BrickColor.new("Crimson").Color, BrickColor.new("Crimson").Color)
222
		end
223
		if Type == "Normal" then
224
			local vp = Create("BodyVelocity"){
225
				P = 500,
226
				maxForce = Vector3.new(math.huge, 0, math.huge),
227
				velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05,
228
			}
229
			if knockback > 0 then
230
				vp.Parent = hit.Parent.Torso
231
				
232
			end
233
			game:GetService("Debris"):AddItem(vp, .5)
234
		local debounce = Create("BoolValue"){
235
			Name = "DebounceHit",
236
			Parent = hit.Parent,
237
			Value = true,
238
		}
239
		game:GetService("Debris"):AddItem(debounce, Delay)
240
		c = Instance.new("ObjectValue")
241
		c.Name = "creator"
242
		c.Value = player
243
		c.Parent = h
244
		game:GetService("Debris"):AddItem(c, .5)
245
		return Damage
246
		end
247
	end
248
end
249
250
local attackDebounce = false
251
local attack = 0
252
mse.Button1Down:connect(function()
253
	if equipped and not attackDebounce and ActiveAnim ~= "Run" then
254
		--[[Humanoid.WalkSpeed = 0
255
		Humanoid.JumpPower = 0]]
256
		attackDebounce=true
257
		attacking = true
258
		attack = 1
259
		local p={}
260
		local connection = knife.Touched:connect(function(o)
261
			if not p[o.Parent] then
262
				local h = Damagefunc(knife,o,25,40,0,"Normal",RootPart,0)
263
				p[o.Parent] = true
264
				if h then
265
					Humanoid.Health = Humanoid.Health + h
266
				end
267
			end
268
		end)
269
		for i = 0, 1, .1 do
270
			local val = CFrame.new(1.5, 0.689999819, -0.499969482, 0.85814029, -0.45942992, -0.229171112, -0.467216164, -0.513756752, -0.719557583, 0.212848067, 0.724553764, -0.655528486);
271
			Nek.C0 = clerp(Nek.C0,necko,.2)
272
			RS.C0=clerp(RS.C0,val,.2)
273
			swait()
274
		end
275
		wait()
276
		for i = 0, 1, .1 do
277
			local val = CFrame.new(0.65999794, 0.150000095, -0.719955444, 0.718477786, 0.65810138, -0.225149795, -0.545639813, 0.332532972, -0.769219816, -0.431354851, 0.675518036, 0.598003805);
278
			Nek.C0 = clerp(Nek.C0,necko,.2)
279
			knifweld.C0 = clerp(knifweld.C0,CFrame.new(2.3,0,0)*CFrame.Angles(math.rad(90),math.rad(0),math.rad(-90)),.2)
280
			RS.C0 = clerp(RS.C0,val,.2)
281
			swait()
282
		end
283
		wait(.3)
284
		spawn(function()
285
			for i = 0, 1, .1 do
286
				knifweld.C0 = clerp(knifweld.C0,CFrame.new(1,1,0)*CFrame.Angles(0,math.rad(90),0),.2)
287
				swait()
288
			end
289
		end)
290
		connection:disconnect()
291
		attacking = false
292
		p=nil
293
		attack = 0
294
		Humanoid.WalkSpeed = 24
295
		Humanoid.JumpPower = 50
296
		wait(.3)
297
		attackDebounce=false
298
	end
299
end)
300
301
Humanoid.WalkSpeed = 24
302-
Humanoid.MaxHealth = 10000000
302+
Humanoid.MaxHealth = 100000000000000
303-
Humanoid.Health = 10000000
303+
Humanoid.Health = 100000000000000
304
UpdateActiveAnim=function()
305
	spawn(function()
306
		local torvel = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude 
307
		local velderp = RootPart.Velocity.y
308
		local hitfloor, posfloor = rayCast(RootPart.Position, (CFrame.new(RootPart.Position, RootPart.Position - Vector3.new(0, 2, 0))).lookVector, 4, character)
309
		if torvel > 2 and hitfloor and Humanoid.WalkSpeed < 21 then
310
			ActiveAnim="Walk"
311
		elseif torvel > 2 and hitfloor and Humanoid.WalkSpeed >= 21 then
312
			ActiveAnim="Run"
313
		elseif RootPart.Velocity.y > 1 and not hitfloor then
314
			ActiveAnim="Jump"
315
		elseif RootPart.Velocity.y < -1 and not hitfloor then
316
			ActiveAnim="Fall"
317
		else
318
			ActiveAnim="Idle"
319
		end
320
	end)
321
end
322
	function clerp(a, b, t)
323
324
	local function QuaternionFromCFrame(cf)
325
		local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
326
		local trace = m00 + m11 + m22
327
		if trace > 0 then
328
			local s = math.sqrt(1 + trace)
329
			local recip = 0.5 / s
330
			return (m21 - m12) * recip, (m02 - m20) * recip, (m10 - m01) * recip, s * 0.5
331
		else
332
			local i = 0
333
			if m11 > m00 then
334
				i = 1
335
			end
336
			if m22 > (i == 0 and m00 or m11) then
337
				i = 2
338
			end
339
			if i == 0 then
340
				local s = math.sqrt(m00 - m11 - m22 + 1)
341
				local recip = 0.5 / s
342
				return 0.5 * s, (m10 + m01) * recip, (m20 + m02) * recip, (m21 - m12) * recip
343
			elseif i == 1 then
344
				local s = math.sqrt(m11 - m22 - m00 + 1)
345
				local recip = 0.5 / s
346
				return (m01 + m10) * recip, 0.5 * s, (m21 + m12) * recip, (m02 - m20) * recip
347
			elseif i == 2 then
348
				local s = math.sqrt(m22 - m00 - m11 + 1)
349
				local recip = 0.5 / s
350
				return (m02 + m20) * recip, (m12 + m21) * recip, 0.5 * s, (m10 - m01) * recip
351
			end
352
		end
353
	end
354
         
355
	local function QuaternionToCFrame(px, py, pz, x, y, z, w)
356
		local xs, ys, zs = x + x, y + y, z + z
357
		local wx, wy, wz = w * xs, w * ys, w * zs
358
		local xx = x * xs
359
		local xy = x * ys
360
		local xz = x * zs
361
		local yy = y * ys
362
		local yz = y * zs
363
		local zz = z * zs
364
		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))
365
	end
366
         
367
	local function QuaternionSlerp(a, b, t)
368
		local cosTheta = a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]
369
		local startInterp, finishInterp;
370
		if cosTheta >= 0.0001 then
371
			if (1 - cosTheta) > 0.0001 then
372
				local theta = math.acos(cosTheta)
373
				local invSinTheta = 1 / math.sin(theta)
374
				startInterp = math.sin((1 - t) * theta) * invSinTheta
375
				finishInterp = math.sin(t * theta) * invSinTheta
376
			else
377
				startInterp = 1 - t
378
				finishInterp = t
379
			end
380
		else
381
			if (1 + cosTheta) > 0.0001 then
382
				local theta = math.acos(-cosTheta)
383
				local invSinTheta = 1 / math.sin(theta)
384
				startInterp = math.sin((t - 1) * theta) * invSinTheta
385
				finishInterp = math.sin(t * theta) * invSinTheta
386
			else
387
				startInterp = t - 1
388
				finishInterp = t
389
			end
390
		end
391
		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
392
	end
393
394
	local qa = {
395
		QuaternionFromCFrame(a)
396
	}
397
	local qb = {
398
		QuaternionFromCFrame(b)
399
	}
400
	local ax, ay, az = a.x, a.y, a.z
401
	local bx, by, bz = b.x, b.y, b.z
402
403
	local _t = 1 - t
404
	return QuaternionToCFrame(_t * ax + t * bx, _t * ay + t * by, _t * az + t * bz, QuaternionSlerp(qa, qb, t))
405
end
406
407
while swait() do
408
	spawn(function()
409
		if Keys["48"] and not attacking and not equipping then
410
			Humanoid.WalkSpeed = 28
411
		else
412
			Humanoid.WalkSpeed = 12
413
		end
414
	end)
415
	sine=sine+change
416
	if not attack then
417
		idle=idle+1
418
	else
419
		idle=0
420
	end
421
	if idle >=500 then
422
		if attack==false then end
423
	end
424
	if donum>.5 then handidle=true elseif donum <= 0 then handidle=false end
425
	if handidle==false then
426
		donum=donum+.003
427
	else
428
		donum=donum-.003
429
	end
430
	UpdateActiveAnim()
431
	if ActiveAnim == "Idle" then
432
		change = .3
433
		LH.C0 = clerp(LH.C0, CFrame.new(0, -1.5, 0)*angles(0,0,math.rad(-5)), .4)
434
		RH.C0 = clerp(RH.C0, CFrame.new(0, -1.5, 0)*angles(0,0,math.rad(5)),.4)
435
		LS.C0=clerp(LS.C0,cf(-1.5,.5,0)*angles(0,0,-donum*.35),.2)
436
		if not equipping2 and not attacking then
437
			RS.C0=clerp(RS.C0,cf(1.5,.5,0)*angles(0,0,donum*.35),.2)
438
		end
439
		if not attacking then
440
			Nek.C0 = clerp(Nek.C0,necko*CFrame.Angles(math.rad(25),0,0),.2)
441
		end
442
	elseif ActiveAnim == "Walk" then
443
		change = 2
444
		LH.C0 = clerp(LH.C0, CFrame.new(0, -1.5-0.3*math.cos(sine/26)/2, -.05 + math.sin(sine/26)/2) * CFrame.Angles(math.rad(-18) + -math.sin(sine/26)/2.3, 0, 0), .4)
445
		RH.C0 = clerp(RH.C0, CFrame.new(0, -1.5+0.3*math.cos(sine/26)/2, -.05 + -math.sin(sine/26)/2) * CFrame.Angles(math.rad(-18) + math.sin(sine/26)/2.3, 0, 0), .4)
446
		LS.C0=clerp(LS.C0,cf(-1.5,.5,0)*angles(math.sin(sine/26)/2,0,0),.4)
447
		if not equipping2 and not attacking then
448
			RS.C0=clerp(RS.C0,cf(1.5,.5,0)*angles(math.sin(-sine/26)/2,0,0),.2)
449
		end
450
		if not attacking then
451
			Nek.C0 = clerp(Nek.C0,necko*CFrame.Angles(math.rad(25),0,0),.2)
452
		end
453
	elseif ActiveAnim == "Run" then
454
		change = 4
455
		LH.C0 = clerp(LH.C0, CFrame.new(0, -1.5-0.3*math.cos(sine/26)/2, -.05 + math.sin(sine/26)/2) * CFrame.Angles(math.rad(-18) + -math.sin(sine/26)/2.3, 0, 0), .4)
456
		RH.C0 = clerp(RH.C0, CFrame.new(0, -1.5+0.3*math.cos(sine/26)/2, -.05 + -math.sin(sine/26)/2) * CFrame.Angles(math.rad(-18) + math.sin(sine/26)/2.3, 0, 0), .4)
457
		LS.C0=clerp(LS.C0,cf(-1.5,.5,0)*angles(math.sin(sine/26)/2,0,0),.4)
458
		RS.C0=clerp(RS.C0,cf(1.5,.5,0)*angles(math.sin(-sine/26)/2,0,0),.2)
459
		Nek.C0 = clerp(Nek.C0,necko*CFrame.Angles(math.rad(25),0,0),.2)
460
	elseif ActiveAnim == "Jump" then
461
		LS.C0 = clerp(LS.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-10), math.rad(0), math.rad(-20)), 0.3)
462
		RH.C0 = clerp(RH.C0, cf(.05, -1.5, .5) * angles(math.rad(-20), math.rad(0), math.rad(5)), .3)
463
		LH.C0 = clerp(LH.C0, cf(-.05, -1.5, .5) * angles(math.rad(-20), math.rad(0), math.rad(-5)), .3)
464
		if not equipping2 and not attacking then
465
			RS.C0 = clerp(RS.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(30)), 0.3)
466
		end
467
		if not attacking then
468
			Nek.C0 = clerp(Nek.C0,necko*CFrame.Angles(math.rad(25),0,0),.2)
469
		end
470
	elseif ActiveAnim == "Fall" then
471
		LS.C0 = clerp(LS.C0, CFrame.new(-1.5, 0.5, 0) * angles(math.rad(-20), math.rad(0), math.rad(-30)), 0.3)
472
		RH.C0 = clerp(RH.C0, cf(0.05, -1.5, -.2) * angles(math.rad(10), math.rad(0), math.rad(5)), .3)
473
		LH.C0 = clerp(LH.C0, cf(-0.05, -1.5, -.2) * angles(math.rad(10), math.rad(0), math.rad(-5)), .3)
474
		LS.C1 = clerp(LS.C1, cf(0, 0.5, 0) * euler(0, 0, 0), .3)
475
		if not equipping2 and not attacking then
476
			RS.C0 = clerp(RS.C0, CFrame.new(1.5, 0.5, 0) * angles(math.rad(-30), math.rad(0), math.rad(40)), 0.3)
477
		end
478
		if not attacking then
479
			Nek.C0 = clerp(Nek.C0,necko*CFrame.Angles(math.rad(10),0,0),.2)
480
		end
481
	end
482
end