View difference between Paste ID: fkEbiTyC and PtFhzaB8
SHOW: | | - or go back to the newest paste.
1
--By Rufus14
2
--owner = game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
3
character = owner.Character
4
NLS([[
5
--By Rufus14
6
owner = game:GetService("Players").LocalPlayer
7
local ownerhead = owner.Character:WaitForChild("Head")
8
parkietremote = owner.Character:WaitForChild("parkietremote")
9
mouse = owner:GetMouse()
10
local part = Instance.new("Part", owner.Character.Head)
11
part.Size = Vector3.new(0.1,0.1,0.1)
12
part.Transparency = 1
13
part.CanCollide = false
14
part.Name = "camera"
15
part:BreakJoints()
16
local weld = Instance.new("Weld", part)
17
weld.Part0 = owner.Character.Head
18
weld.Part1 = part
19
weld.C0 = CFrame.new(0,0,-1)
20
cananimate = true
21
walkpressed = 0
22
humanoid = owner.Character:findFirstChildOfClass("Humanoid")
23
rootpart = owner.Character.HumanoidRootPart
24
runservice = game:GetService("RunService")
25
--
26
canmovecamera = true
27
wrunning = false
28
wrunningl = false
29
owner.Character.ChildAdded:connect(function(whatadded)
30
	if whatadded.Name == "slide" then
31
		canmovecamera = false
32
		for i = 1,60 do
33
			workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(math.sin(tick()*45)/(i/6)),0,0)
34
			runservice.RenderStepped:wait()
35
		end
36
	elseif whatadded.Name == "vwallrun" then
37
		canmovecamera = false
38
		for i = 1,20 do
39
			workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(2),0,0)
40
			runservice.RenderStepped:wait()
41
		end
42
	elseif whatadded.Name == "hwallrunright" then
43
		wrunning = true
44
		canmovecamera = false
45
		coroutine.wrap(function()
46
			while wrunning and runservice.RenderStepped:wait() do
47
				workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:lerp(workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.2) 
48
			end
49
		end)()
50
	elseif whatadded.Name == "hwallrunleft" then
51
		wrunningl = true
52
		canmovecamera = false
53
		coroutine.wrap(function()
54
			while wrunningl and runservice.RenderStepped:wait() do
55
				workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:lerp(workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.2) 
56
			end
57
		end)()
58
	elseif whatadded.Name == "FALLING" then
59
		local screengui = Instance.new("ScreenGui", owner:findFirstChildOfClass("PlayerGui"))
60
		screengui.ResetOnSpawn = true
61
		screengui.Name = "ohgodohfuck"
62
		local vel = Instance.new("BodyVelocity", rootpart)
63
		vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
64
		vel.Velocity = Vector3.new(0,-135,0)
65
		local frame = Instance.new("ImageLabel", screengui)
66
		frame.BackgroundTransparency = 1
67
		frame.ImageTransparency = 1
68
		frame.ImageColor3 = Color3.fromRGB(0,0,0)
69
		frame.Image = "http://www.roblox.com/asset/?id=22606915"
70
		frame.Size = UDim2.new(1,0,1,0)
71
		for i = 1,20 do
72
			frame.ImageTransparency = frame.ImageTransparency - 0.05
73
			runservice.Stepped:wait()
74
		end
75
		coroutine.wrap(function()
76
			while rootpart.Velocity.y < -10 do runservice.RenderStepped:wait() end
77
			screengui:destroy()
78
			vel:destroy()
79
			owner.Character:BreakJoints()
80
		end)()
81
	end
82
end)
83
owner.Character.ChildRemoved:connect(function(whatremoved)
84
	if whatremoved.Name == "slide" then
85
		canmovecamera = true
86
	elseif whatremoved.Name == "vwallrun" then
87
		for i = 1,20 do
88
			workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-2),0,0)
89
			runservice.RenderStepped:wait()
90
		end
91
		canmovecamera = true
92
	elseif whatremoved.Name == "hwallrunright" then
93
		canmovecamera = true
94
		wrunning = false
95
	elseif whatremoved.Name == "hwallrunleft" then
96
		canmovecamera = true
97
		wrunningl = false
98
	end
99
end)
100
--
101
mouse.KeyDown:connect(function(key)
102
	key = key:lower()
103
	if key == "w" or key == "a" or key == "s" or key == "d" then
104-
		walkpressed = walkpressed + 1
104+
		walkpressed = walkpressed + 3
105
	end
106
	if key == "r" then
107
		parkietremote:FireServer(rootpart.CFrame, "triggerroll")
108
	end
109
	if key == "e" then
110
		parkietremote:FireServer(rootpart.CFrame, "slide")
111
	end
112
end)
113
mouse.KeyUp:connect(function(key)
114
	key = key:lower()
115
	if key == "w" or key == "a" or key == "s" or key == "d" then
116
		walkpressed = walkpressed - 1
117
	end
118
	if key == "r" then
119
		parkietremote:FireServer(rootpart.CFrame, "triggerroll")
120
	end
121
end)
122
--
123
humanoid.Died:connect(function()
124
	local correction =  Instance.new("ColorCorrectionEffect", workspace.CurrentCamera)
125
	local deathsound = Instance.new("Sound", owner:findFirstChildOfClass("PlayerGui"))
126
	deathsound.SoundId = "rbxassetid://1038809455"
127
	deathsound.Volume = 10
128
	deathsound:Play()
129
	game.Debris:AddItem(deathsound, deathsound.TimeLength)
130
	game.Debris:AddItem(correction, game:GetService("Players").RespawnTime)
131
	for i = 1,5 do
132
		correction.Brightness = correction.Brightness + 0.2
133
		runservice.RenderStepped:wait()
134
	end
135
	while runservice.RenderStepped:wait() do
136
		workspace.CurrentCamera.CFrame = CFrame.new(0,9999999,0)
137
	end
138
end)
139
--
140
while game:GetService("RunService").RenderStepped:wait() do
141
	----
142
	local vwallray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 2)
143
	local vwallhit, vwallpos, vwallsurface = workspace:FindPartOnRayWithIgnoreList(vwallray, {owner.Character})
144
	if vwallhit and humanoid.Jump and rootpart.Velocity.y > -30 then
145
		if not vwallhit.Parent:findFirstChildOfClass("Humanoid") then
146
			parkietremote:FireServer(rootpart.CFrame, "vwallrun", vwallhit, vwallpos, vwallsurface)
147
		end
148
	end
149
	---
150
	local hwallray = Ray.new(rootpart.CFrame.p, (rootpart.CFrame.rightVector * 3.5) + (rootpart.CFrame.lookVector * -0.3))
151
	local hwallhit, hwallpos, surface = workspace:FindPartOnRayWithIgnoreList(hwallray, {owner.Character})
152
	if hwallhit and humanoid.Jump and rootpart.Velocity.y > -20 then
153
		if not hwallhit.Parent:findFirstChildOfClass("Humanoid") then
154
			parkietremote:FireServer(rootpart.CFrame, "hwallrunright", hwallhit, hwallpos, surface)
155
		end
156
	end
157
	--
158
	local hwallrayl = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -3.5 + (rootpart.CFrame.lookVector * -0.3))
159
	local hwallhitl, hwallposl, surfacel = workspace:FindPartOnRayWithIgnoreList(hwallrayl, {owner.Character})
160
	if hwallhitl and humanoid.Jump and rootpart.Velocity.y > -20 then
161
		if not hwallhitl.Parent:findFirstChildOfClass("Humanoid") then
162
			parkietremote:FireServer(rootpart.CFrame, "hwallrunleft", hwallhitl, hwallposl, surfacel)
163
		end
164
	end
165
	---
166
	local poleray = Ray.new(ownerhead.CFrame.p, ownerhead.CFrame.lookVector * 3.5)
167
	local polerayhit, poleraypos, poleraysurface = workspace:FindPartOnRayWithIgnoreList(poleray, {owner.Character})
168
	if polerayhit and rootpart.Velocity.y > -60 then
169
		if not polerayhit.Parent:findFirstChildOfClass("Humanoid") then
170
			parkietremote:FireServer(rootpart.CFrame, "polegrab", polerayhit, poleraypos, poleraysurface)
171
		end
172
	end
173
	--
174
	local poleray = Ray.new(ownerhead.CFrame.p, (ownerhead.CFrame.lookVector * 3.5) + (ownerhead.CFrame.upVector * -0.5))
175
	local polerayhit, poleraypos, poleraysurface = workspace:FindPartOnRayWithIgnoreList(poleray, {owner.Character})
176
	if polerayhit and rootpart.Velocity.y > -60 then
177
		if not polerayhit.Parent:findFirstChildOfClass("Humanoid") then
178
			parkietremote:FireServer(rootpart.CFrame, "polegrab", polerayhit, poleraypos, poleraysurface)
179
		end
180
	end
181
	--
182
	local poleray = Ray.new(ownerhead.CFrame.p, (ownerhead.CFrame.lookVector * 3.5) + (ownerhead.CFrame.upVector * 0.5))
183
	local polerayhit, poleraypos, poleraysurface = workspace:FindPartOnRayWithIgnoreList(poleray, {owner.Character})
184
	if polerayhit and rootpart.Velocity.y > -60 then
185
		if not polerayhit.Parent:findFirstChildOfClass("Humanoid") then
186
			parkietremote:FireServer(rootpart.CFrame, "polegrab", polerayhit, poleraypos, poleraysurface)
187
		end
188
	end
189
	----
190
	if walkpressed > 0 and humanoid.WalkSpeed < 23 and not owner.Character:findFirstChild("ouchfell") then
191
		humanoid.WalkSpeed = humanoid.WalkSpeed + 1.2
192
	elseif walkpressed == 0 and humanoid.WalkSpeed > 0 and not owner.Character:findFirstChild("ouchfell") then
193
		humanoid.WalkSpeed = humanoid.WalkSpeed - 1.2
194
	end
195
	if (workspace.CurrentCamera.CFrame.p - part.Position).magnitude <= 1.7 then
196
		if canmovecamera and not owner.Character:findFirstChild("ouchfell") and not owner.Character:findFirstChild("rollin") and not owner.Character:findFirstChild("pole") then
197
			game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(mouse.Hit.p.x,game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position.y,mouse.Hit.p.z))
198
		end
199
		if owner.Character:findFirstChild("ouchfell") then
200
			workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.4)
201
		end
202
		if owner.Character:findFirstChild("rollin") then
203
			workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.2)
204
		end
205
		if owner.Character:findFirstChild("FALLING") then
206
			canmovecamera = false
207
			workspace.CurrentCamera.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-0.4) * CFrame.fromEulerAnglesXYZ(math.rad(math.sin(tick()*45))*6,0,0)
208
		end
209
		workspace.CurrentCamera.FieldOfView = 120
210
		for i,v in pairs(owner.Character:GetChildren()) do
211
			if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "Head" then
212
				v.LocalTransparencyModifier = 0
213
			end
214
			if v.ClassName == "Accessory" then
215
				v.Handle.Transparency = 1
216
	        end
217
		end
218
		if owner.Character.Head:findFirstChildOfClass("Decal") then
219
		    owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 1
220
		end
221
		owner.Character.Head.Transparency = 1
222
		workspace.CurrentCamera.CameraSubject = part
223
	else
224
		for i,v in pairs(owner.Character:GetChildren()) do
225
			if v.ClassName == "Accessory" then
226
				v.Handle.Transparency = 0
227
	        end
228
		end
229
		workspace.CurrentCamera.FieldOfView = 70
230
		owner.Character.Head.Transparency = 0
231
		if owner.Character.Head:findFirstChildOfClass("Decal") then
232
		    owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 0
233
		end
234
		workspace.CurrentCamera.CameraSubject = owner.Character
235
	end
236
end
237
]], character)
238
local ownerhead = character:WaitForChild("Head")
239
mouse = owner:GetMouse()
240
anim = "idle"
241
cananimate = true
242
humanoid = character:findFirstChildOfClass("Humanoid")
243
rootpart = character.HumanoidRootPart
244
runservice = game:GetService("RunService")
245
local rightarm = Instance.new("Weld", owner.Character.Torso)
246
rightarm.Part0 = owner.Character.Torso
247
rightarm.Part1 = owner.Character["Right Arm"]
248
rightarm.C0 = CFrame.new(1.5,0,0)
249
rightarm.Name = "RightArmWeld"
250
local rightleg = Instance.new("Weld", owner.Character.Torso)
251
rightleg.Part0 = owner.Character.Torso
252
rightleg.Part1 = owner.Character["Right Leg"]
253
rightleg.C0 = CFrame.new(0.5,-2,0)
254
rightleg.Name = "RightLegWeld"
255
local leftarm = Instance.new("Weld", owner.Character.Torso)
256
leftarm.Part0 = owner.Character.Torso
257
leftarm.Part1 = owner.Character["Left Arm"]
258
leftarm.C0 = CFrame.new(-1.5,0,0)
259
leftarm.Name = "LeftArmWeld"
260
local leftleg = Instance.new("Weld", owner.Character.Torso)
261
leftleg.Part0 = owner.Character.Torso
262
leftleg.Part1 = owner.Character["Left Leg"]
263
leftleg.C0 = CFrame.new(-0.5,-2,0)
264
leftleg.Name = "LeftLegWeld"
265
local head = Instance.new("Weld", owner.Character.Torso)
266
head.Part0 = owner.Character.Torso
267
head.Part1 = owner.Character.Head
268
head.C0 = CFrame.new(0,1.5,0)
269
head.Name = "HeadWeld"
270
local humanoidrootpart = Instance.new("Weld", owner.Character.HumanoidRootPart)
271
humanoidrootpart.Part0 = owner.Character.HumanoidRootPart
272
humanoidrootpart.Part1 = owner.Character.Torso
273
humanoidrootpart.Name = "HumanoidRootPartWeld"
274
local music = Instance.new("Sound", owner.Character.Head)
275
music.Looped = true
276
local musicrandom = math.random(1,5)
277
if musicrandom == 1 then
278
	music.SoundId = "rbxassetid://4502246491"
279
	music.Volume = 2
280
elseif musicrandom == 2 then
281
	music.SoundId = "rbxassetid://469593664"
282
	music.Volume = 2
283
elseif musicrandom == 3 then
284
	music.SoundId = "rbxassetid://477207390"
285
	music.Volume = 2
286
elseif musicrandom == 4 then
287
	music.SoundId = "rbxassetid://147811295"
288
	music.Volume = 2
289
elseif musicrandom == 5 then
290
	music.SoundId = "rbxassetid://4519453403"
291
	music.Volume = 1
292
end
293
music:Play()
294
local runsound = Instance.new("Sound", owner.Character.Head)
295
runsound.SoundId = "rbxassetid://3084278209"
296
runsound.Looped = true
297
runsound:Play()
298
runsound.PlaybackSpeed = 1.4
299
local bodyhitsound = Instance.new("Sound", owner.Character.Head)
300
bodyhitsound.SoundId = "rbxassetid://261338552"
301
bodyhitsound.Volume = 0.5
302
local fallingsound = Instance.new("Sound", owner.Character.Head)
303
fallingsound.SoundId = "rbxassetid://866649671"
304
fallingsound.Volume = 0
305
fallingsound.Looped = true
306
fallingsound:Play()
307
local parkietremote = Instance.new("RemoteEvent", character)
308
parkietremote.Name = "parkietremote"
309
cando = true
310
roll = false
311
fallingtodeath = false
312
grabbedpole = false
313
parkietremote.OnServerEvent:connect(function(plr, rootpos, what, rayehit, rayepos, rayesurface)
314
	if plr == owner and not fallingtodeath and cando then
315
		character.HumanoidRootPart.CanCollide = false
316
		if what == "slide" then
317
			cananimate = false
318
			cando = false
319
			local action = Instance.new("BoolValue", character)
320
			action.Name = "slide"
321
			local velo = Instance.new("BodyVelocity", rootpart)
322
			velo.MaxForce = Vector3.new(math.huge,0,math.huge)
323
			velo.Velocity = rootpart.CFrame.lookVector*22
324
			runsound.Volume = 0
325
			for i = 0,1 , 0.04 do
326
				rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.70441437, 0.561628342, 9.53674316e-07, 0.642787516, -0.766044259, 1.49011612e-08, 0.766044319, 0.642787576, 0, 1.17273338e-08, -1.27691155e-08, 0.99999994),i)
327
				leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.54449558, -0.470175743, -0.242582321, 0.983905256, -0.168530971, 0.0593911819, 0.178687513, 0.926305115, -0.331706733, 0.000888578361, 0.336980522, 0.941511095),i)
328
				leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.500000954, -1.64282608, -0.0428800583, 0.999999821, -1.0857935e-08, 1.23050938e-08, 0, 0.939692557, 0.342019677, 1.49011612e-08, -0.342019677, 0.939692557),i)
329
				rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2, 0, 0.999999821, 0, 1.49011612e-08, 0, 0.99999994, 0, 1.49011612e-08, 0, 0.99999994),i)
330
				humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(-0.416755676, -2.3635385, 0, 0.98480767, 0, -0.173648164, -0.173648179, -4.37113883e-08, -0.98480773, -7.59040297e-09, 1, -4.30473115e-08),i)
331
				head.C0 = head.C0:lerp(CFrame.new(-9.53674316e-07, 1.15137196, -0.85847187, 0.999999821, -4.60215439e-08, -1.65799918e-07, 1.71363354e-07, 0.173648059, 0.98480767, 2.98023153e-08, -0.984807611, 0.173648059),i)
332
				runservice.Stepped:wait()
333
			end
334
			local funnysine = 0
335
			for i = 1,60 do
336
				local ray = Ray.new(character.Torso.Position, character.Torso.CFrame.upVector*-5.5)
337
				local hit, positionn = workspace:FindPartOnRayWithIgnoreList(ray, {character})
338
				if hit then
339
					break
340
				end
341
				velo.Velocity = velo.Velocity/1.01
342
				runservice.Stepped:wait()
343
			end
344
			velo:destroy()
345
			action:destroy()
346
			cananimate = true
347
			cando = true
348
		elseif what == "vwallrun" then
349
			local polereally = false
350
			if rayehit.Size.y <= 1 then
351
				if rayehit.Size.z > rayehit.Size.x and rayehit.Size.x <= 1 then
352
					--print("pole z > x BAD")
353
					polereally = true
354
				elseif rayehit.Size.x > rayehit.Size.z and rayehit.Size.z <= 1 then
355
					--print("pole x > z BAD")
356
					polereally = true
357
				end
358
			end
359
			if not polereally then
360
				cananimate = false
361
				cando = false
362
				humanoid.AutoRotate = false
363
				local action = Instance.new("BoolValue", character)
364
				action.Name = "vwallrun"
365
				character.HumanoidRootPart.CFrame = rootpos
366
				local goupvel = Instance.new("BodyVelocity", rootpart)
367
				goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
368
				goupvel.Velocity = Vector3.new(0,20,0)
369
				local gotin = false
370
				for i = 1,70 do
371
					local headray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.upVector * 3.5)
372
					local headrayhit, headraypos = workspace:FindPartOnRayWithIgnoreList(headray, {owner.Character})
373
					if headrayhit then
374
						gotin = false
375
						break
376
					end
377
					local headraywall = Ray.new(ownerhead.CFrame.p, ownerhead.CFrame.lookVector * 3)
378
					local headraywallhit, headraywallpos = workspace:FindPartOnRayWithIgnoreList(headraywall, {owner.Character})
379
					if not headraywallhit then
380
						gotin = true
381
						break
382
					end
383
					goupvel.Velocity = goupvel.Velocity/1.025
384
					humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(),0.3)
385
					head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(30),0,0) * CFrame.new(0,0.5,0),0.3)
386
					leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/5),0,math.cos(i/5)/3) * CFrame.new(0,-0.5,0),0.3)
387
					rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.pi/2-math.sin(i/5),0,-math.cos(i/5)/3) * CFrame.new(0,-0.5,0),0.3)
388
					leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(i/5)/2,0) * CFrame.Angles(-math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.3)
389
					rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1+math.cos(i/5)/2,0) * CFrame.Angles(math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.3)
390
					runservice.Stepped:wait()
391
				end
392
				action:destroy()
393
				if gotin then
394
					rootpart.Anchored = true
395
					for i = 1,30 do
396
						rootpart.CFrame = rootpart.CFrame * CFrame.new(0,0.15,-math.sin(i/14)/9)
397
						humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-20),0,0),0.3)
398
						head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(20),0,0) * CFrame.new(0,0.5,0),0.3)
399
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.rad(60)+math.cos(i/7)*1.5,0,0) * CFrame.new(0,-0.5,0),0.3)
400
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(60)+math.cos(i/7)*1.5,0,0) * CFrame.new(0,-0.5,0),0.3)
401
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,-1,0),0.3)
402
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-0.25+math.cos(i/7)/1.2,-0.5) * CFrame.Angles(0,0,0) * CFrame.new(0,-1,0),0.3)
403
						runservice.Stepped:wait()
404
					end
405
				end
406
				humanoid.AutoRotate = true
407
				rootpart.Anchored = false
408
				goupvel:destroy()
409
				cananimate = true
410
				cando = true
411
			end
412
		elseif what == "hwallrunright" and anim == "jumprun" or anim == "fallrun" and rayepos ~= nil then
413
			cananimate = false
414
			cando = false
415
			humanoid.AutoRotate = false
416
			local action = Instance.new("BoolValue", character)
417
			action.Name = "hwallrunright"
418
			rootpart.CFrame = CFrame.new(rayepos, rayepos + rayesurface) * CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)
419
			rootpart.CFrame = rootpart.CFrame * CFrame.new(-1.8,0,0)
420
			if rootpart:findFirstChild("wallrunvel") then
421
				rootpart:findFirstChild("wallrunvel"):destroy()
422
			end
423
			local goupvel = Instance.new("BodyVelocity", rootpart)
424
			goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
425
			goupvel.Velocity = rootpart.CFrame.lookVector * 20
426
			goupvel.Name = "wallrunvel"
427
			runsound.PlaybackSpeed = 1.7
428
			runsound.Volume = 1.5
429
			local jumped = false
430
			local shouldcontinue = true
431
			local candothat = true
432
			for i = 1,20 do
433
				local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * 2.5)
434
				local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
435
				if not wallrighthit then
436
					shouldcontinue = false
437
					break
438
				end
439
				local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
440
				local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
441
				if rootfrontrayhit then
442
					shouldcontinue = false
443
					break
444
				end
445
				humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.3)
446
				head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
447
				leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(-15)) * CFrame.new(0,-0.5,0),0.3)
448
				rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(0,0,math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
449
				leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
450
				rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
451
				runservice.Stepped:wait()
452
			end
453
			for i = 1,60 do
454
				if candothat then
455
					if not shouldcontinue then
456
						break
457
					end
458
					if humanoid.Jump then
459
						jumped = true
460
						break
461
					end
462
					local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * 2.5)
463
					local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
464
					if not wallrighthit then
465
						break
466
					end
467
					local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
468
					local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
469
					if rootfrontrayhit then
470
						break
471
					end
472
					humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(30)),0.3)
473
					head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
474
					leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(-15)) * CFrame.new(0,-0.5,0),0.3)
475
					rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(0,0,math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
476
					leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
477
					rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
478
					runservice.Stepped:wait()
479
				end
480
			end
481
			action:destroy()
482
			candothat = false
483
			if jumped then
484
				goupvel.Velocity = goupvel.Velocity + (rootpart.CFrame.rightVector*-20) + Vector3.new(0,5,0)
485
				game.Debris:AddItem(goupvel, 0.25)
486
				for i = 0,0.6 ,0.03 do
487
					if not cananimate then
488
						head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),math.rad(-5),0) * CFrame.new(0,0.5,0),i)
489
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.fromEulerAnglesXYZ(-math.rad(40),0,math.rad(-2)) * CFrame.new(0,-1,0),i)
490
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(math.rad(40),0,math.rad(2)) * CFrame.new(0,-1,0),i)
491
						humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-10),0,math.rad(10)),i)
492
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20),0,0) * CFrame.new(0,-0.5,0),i)
493
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-math.pi/3,0,0) * CFrame.new(0,-0.5,0),i)
494
						runservice.Stepped:wait()
495
					end
496
				end
497
			else
498
				goupvel:destroy()
499
			end
500
			humanoid.AutoRotate = true
501
			cananimate = true
502
			cando = true
503
		elseif what == "hwallrunleft" and anim == "jumprun" or anim == "fallrun" and rayepos ~= nil then
504
			cananimate = false
505
			cando = false
506
			humanoid.AutoRotate = false
507
			local action = Instance.new("BoolValue", character)
508
			action.Name = "hwallrunleft"
509
			rootpart.CFrame = CFrame.new(rayepos, rayepos + rayesurface) * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)
510
			rootpart.CFrame = rootpart.CFrame * CFrame.new(1.8,0,0)
511
			if rootpart:findFirstChild("wallrunvel") then
512
				rootpart:findFirstChild("wallrunvel"):destroy()
513
			end
514
			local goupvel = Instance.new("BodyVelocity", rootpart)
515
			goupvel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
516
			goupvel.Velocity = rootpart.CFrame.lookVector * 20
517
			goupvel.Name = "wallrunvel"
518
			runsound.PlaybackSpeed = 1.7
519
			runsound.Volume = 1.5
520
			local jumped = false
521
			local shouldcontinue = true
522
			local candothat = true
523
			for i = 1,20 do
524
				local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -2.5)
525
				local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
526
				if not wallrighthit then
527
					shouldcontinue = false
528
					break
529
				end
530
				local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
531
				local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
532
				if rootfrontrayhit then
533
					shouldcontinue = false
534
					break
535
				end
536
				humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.3)
537
				head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
538
				leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,0,-math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
539
				rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(15)) * CFrame.new(0,-0.5,0),0.3)
540
				leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
541
				rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
542
				runservice.Stepped:wait()
543
			end
544
			for i = 1,60 do
545
				if candothat then
546
					if not shouldcontinue then
547
						break
548
					end
549
					if humanoid.Jump then
550
						jumped = true
551
						break
552
					end
553
					local rootrightray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.rightVector * -2.5)
554
					local wallrighthit, rootrightraypos = workspace:FindPartOnRayWithIgnoreList(rootrightray, {owner.Character})
555
					if not wallrighthit then
556
						break
557
					end
558
					local rootfrontray = Ray.new(rootpart.CFrame.p, rootpart.CFrame.lookVector * 4)
559
					local rootfrontrayhit, rootfrontraypos = workspace:FindPartOnRayWithIgnoreList(rootfrontray, {owner.Character})
560
					if rootfrontrayhit then
561
						break
562
					end
563
					humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,0,math.rad(-30)),0.3)
564
					head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(0,0,0) * CFrame.new(0,0.5,0),0.3)
565
					leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,0,-math.pi/1.5) * CFrame.new(0,-0.5,0),0.3)
566
					rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(-math.sin(tick()*14)*1.3,0,math.rad(15)) * CFrame.new(0,-0.5,0),0.3)
567
					leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*14)/2,-math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
568
					rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*14)/2,math.cos(tick()*14)/2) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*14),0,0) * CFrame.new(0,-1,0),0.2)
569
					runservice.Stepped:wait()
570
				end
571
			end
572
			action:destroy()
573
			candothat = false
574
			if jumped then
575
				goupvel.Velocity = goupvel.Velocity + (rootpart.CFrame.rightVector*20) + Vector3.new(0,5,0)
576
				game.Debris:AddItem(goupvel, 0.25)
577
				for i = 0,0.6 ,0.03 do
578
					if not cananimate then
579
						head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),math.rad(-5),0) * CFrame.new(0,0.5,0),i)
580
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.fromEulerAnglesXYZ(-math.rad(40),0,math.rad(-2)) * CFrame.new(0,-1,0),i)
581
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(math.rad(40),0,math.rad(2)) * CFrame.new(0,-1,0),i)
582
						humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(math.rad(-10),0,math.rad(-10)),i)
583
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(-math.pi/3,0,0) * CFrame.new(0,-0.5,0),i)
584
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20),0,0) * CFrame.new(0,-0.5,0),i)
585
						runservice.Stepped:wait()
586
					end
587
				end
588
			else
589
				goupvel:destroy()
590
			end
591
			humanoid.AutoRotate = true
592
			cananimate = true
593
			cando = true
594
		elseif what == "triggerroll" then
595
			if roll then
596
				roll = false
597
			elseif not roll then
598
				roll = true
599
			end
600
		elseif what == "polegrab" then
601
			local polereally = false
602
			if rayehit.Size.y <= 1 then
603
				if rayehit.Size.z > rayehit.Size.x and rayehit.Size.x <= 1 then
604
					--print("pole z > x")
605
					polereally = true
606
				elseif rayehit.Size.x > rayehit.Size.z and rayehit.Size.z <= 1 then
607
					--print("pole x > z")
608
					polereally = true
609
				end
610
			end
611
			if polereally then
612
				cando = false
613
				cananimate = false
614
				humanoid.AutoRotate = false
615
				rootpart.Anchored = true
616
				grabbedpole = true
617
				local action = Instance.new("BoolValue", character)
618
				action.Name = "pole"
619
				local thesine = 0
620
				local speed = 3
621
				local sineadd = 0.2
622
				local multiply = 1.2
623
				coroutine.wrap(function()
624
					while grabbedpole and runservice.Stepped:wait() do
625
						thesine = thesine + sineadd
626
						head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(-math.sin(thesine/speed)*(multiply/1.5),0,0) * CFrame.new(0,0.5,0),0.3)
627
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.pi,0,0) * CFrame.new(0,-0.8,0),0.3)
628
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.pi,0,0) * CFrame.new(0,-0.8,0),0.3)
629
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1,0) * CFrame.Angles(math.sin(thesine/speed)*multiply,0,0) * CFrame.new(0,-1,0),0.3)
630
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.Angles(math.sin(thesine/speed)*multiply,0,0) * CFrame.new(0,-1,0),0.3)
631
						rootpart.CFrame = CFrame.new(rayepos, rayepos + rayesurface) * CFrame.fromEulerAnglesXYZ(-math.sin(thesine/speed)*multiply,math.pi,0) * CFrame.new(0,-2.5,0)
632
						if humanoid.Jump and math.sin(thesine/speed) > 0.2 then
633
							rootpart.Anchored = false
634
							grabbedpole = false
635
							action:destroy()
636
							local v = Instance.new("BodyVelocity", rootpart)
637
							v.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
638
							v.Velocity = rootpart.CFrame.lookVector * 20
639
							game.Debris:AddItem(v, 0.5)
640
							humanoid.AutoRotate = true
641
							cananimate = true
642
							cando = true
643
							break
644
						end
645
					end
646
				end)()
647
			end
648
		end
649
	end
650
end)
651
coroutine.wrap(function()
652
	while runservice.Stepped:wait() do
653
		if rootpart.Velocity.x >= 2 or rootpart.Velocity.x <= -2 or rootpart.Velocity.z >= 2 or rootpart.Velocity.z <= -2 then
654
			if humanoid.FloorMaterial == Enum.Material.Air then
655
				if rootpart.Velocity.x >= 16 or rootpart.Velocity.x <= -16 or rootpart.Velocity.z >= 16 or rootpart.Velocity.z <= -16 then
656
					if rootpart.Velocity.y >= 3 then
657
						anim = "jumprun"
658
						--print("jumping (running)")
659
					elseif rootpart.Velocity.y <= -3 then
660
						anim = "fallrun"
661
						--("falling (running)")
662
					end
663
				else
664
					if rootpart.Velocity.y >= 3 then
665
						anim = "jump"
666
						--print("jumping (walking)")
667
					elseif rootpart.Velocity.y <= -3 then
668
						anim = "fall"
669
						--print("falling (walking)")
670
					end
671
				end
672
			else
673
				if rootpart.Velocity.x >= 30 or rootpart.Velocity.x <= -30 or rootpart.Velocity.z >= 30 or rootpart.Velocity.z <= -30 then
674
					anim = "run"
675
					--print("running")
676
				else
677
					anim = "walk"
678
					--print("walking")
679
				end
680
			end
681
		elseif rootpart.Velocity.x <= 2 or rootpart.Velocity.x >= -2 or rootpart.Velocity.z <= 2 or rootpart.Velocity.z >= -2 then
682
			if humanoid.FloorMaterial == Enum.Material.Air then
683
				if rootpart.Velocity.y >= 3 then
684
					anim = "jump"
685
					--print("jumping (standing)")
686
				elseif rootpart.Velocity.y < -3 then
687
					anim = "fall"
688
					--print("falling (standing)")
689
				end
690
			else
691
				anim = "idle"
692
				--print("standing")
693
			end
694
		end
695
	end
696
end)()
697
coroutine.wrap(function()
698
	while runservice.Stepped:wait() do
699
		if rootpart.Velocity.y < -90 then
700
			while rootpart.Velocity.y < 0 and rootpart.Velocity.y >= -135 and runservice.Stepped:wait() do
701
				--print("falling")
702
			end
703
			if rootpart.Velocity.y >= -135 then
704
				cananimate = false
705
				if not roll then
706
					print('hit ground')
707
					runsound.Volume = 0 
708
					bodyhitsound.TimePosition = 1
709
					bodyhitsound:Play()
710
					local action = Instance.new("BoolValue", character)
711
					action.Name = "ouchfell"
712
					humanoid.WalkSpeed = 0
713
					humanoid.JumpPower = 0
714
					humanoid.Health = humanoid.Health - math.random(30,60)
715
					for i = 0,1 , 0.04 do
716
						humanoid.WalkSpeed = 0
717
						humanoid.JumpPower = 0
718
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.03661776, -0.287070274, -0.937994003, 1, 2.13205098e-09, 1.80749957e-08, 2.98023224e-08, 0.642787397, -0.766044438, 4.47034836e-08, 0.766044438, 0.642787457),i)
719
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.00759601593, -0.0868253708, 1.00000012, 4.17280432e-09, 2.23762484e-08, 3.55271368e-15, 0.98480767, -0.173648164, 2.98023224e-08, 0.173648179, 0.98480773),i)
720
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.188133717, -0.968682289, -0.200000763, 0.939692676, -0.342020154, 2.98023224e-08, 0.342020094, 0.939692557, -8.8817842e-16, 2.7206255e-08, -7.1326367e-09, 1),i)
721
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2, -9.53674316e-07, 1.00000012, 3.55271368e-15, 2.98023224e-08, 3.55271368e-15, 0.99999994, -8.8817842e-16, 2.98023224e-08, -8.8817842e-16, 1),i)
722
						humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0.138917923, -1.81215382, -0.199999809, -0.17364794, 0, 0.984807789, -0.984807849, -4.37113883e-08, -0.173647955, 4.3047315e-08, -1, 7.59039409e-09),i)
723
						head.C0 = head.C0:lerp(CFrame.new(0, 1.3184042, -0.620952606, 1.00000012, -2.15236486e-08, 7.42341655e-09, 3.55271368e-15, 0.499999791, 0.866025388, 2.98023224e-08, -0.866025388, 0.499999791),i)
724
						runservice.Stepped:wait()
725
					end
726
					wait(0.7)
727
					for i = 0,0.35 , 0.005 do
728
						humanoid.WalkSpeed = 0
729
						humanoid.JumpPower = 0
730
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.43661785, 0.8717556, -1.1015135, 0.99999994, -1.49011354e-08, 2.58095625e-08, 2.98023171e-08, -0.342020303, -0.939692438, 1.49011914e-08, 0.939692736, -0.342020363),i)
731
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.691013336, -1.08328879, 1, 1.29770106e-14, -3.44476568e-15, -1.36212808e-15, -0.173648149, -0.98480767, 2.84217094e-14, 0.984807968, -0.173648193),i)
732
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -0.697739601, -0.911438107, 0.99999994, 6.67691635e-15, 1.17806545e-14, -1.36212851e-15, 0.939692438, -0.342020303, 2.84217094e-14, 0.342020422, 0.939692795),i)
733
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.500000954, -1.51961517, -1.30000019, 1, 6.15348006e-15, 1.0658141e-14, -1.36212808e-15, 0.866025329, -0.49999997, 2.84217094e-14, 0.500000119, 0.866025627),i)
734
						humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0.138917923, -0.812153816, -0.199999809, 1, 0, -1.93715096e-07, 1.93715096e-07, -4.37113883e-08, 1.00000012, -7.10542736e-15, -1, -4.37113883e-08),i)
735
						head.C0 = head.C0:lerp(CFrame.new(0, 1.56080723, -0.0747625828, 1, -3.66066168e-15, 2.96555518e-14, -1.36212808e-15, 0.98480767, 0.173648074, 2.84217094e-14, -0.173648104, 0.984807909),i)
736
						runservice.Stepped:wait()
737
					end
738
					humanoid.JumpPower = 50
739
					game.Debris:AddItem(action, 0.3)
740
					cananimate = true
741
				else
742
					local action = Instance.new("BoolValue", character)
743
					action.Name = "rollin"
744
					local rotva = 0
745
					coroutine.wrap(function()
746
						humanoidrootpart.C0 = CFrame.new(0,-1.5,0)
747
						for i = 1,35 do
748
							rootpart.CFrame = rootpart.CFrame * CFrame.new(0,0,-0.3)
749
							humanoidrootpart.C0 = humanoidrootpart.C0 * CFrame.fromEulerAnglesXYZ(math.rad(-8.5),0,0)
750
							runservice.Stepped:wait()
751
						end
752
						action:destroy()
753
						cananimate = true
754
					end)()
755
					for i = 0,1 , 0.04 do
756
						rightarm.C0 = rightarm.C0:lerp(CFrame.new(0.5, 0.41317749, -1.40775204, 1.12057243e-08, 1, 4.07854905e-09, 0.173648134, 2.0707327e-09, -0.984807491, -0.984807551, 1.17437136e-08, -0.173648149),i)
757
						leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5, 0.178607941, -0.38302207, 1, 0, 0, 0, 0.642787397, -0.766044199, 0, 0.766044259, 0.642787457),i)
758
						leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -0.93637085, -0.903905869, 1, 0, 0, 0, 0.642787278, 0.766044319, 0, -0.766044378, 0.642787337),i)
759
						rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -1.08567047, -0.913578272, 1, 0, 0, 0, 0.642787516, 0.76604408, 0, -0.76604414, 0.642787576),i)
760
						head.C0 = head.C0:lerp(CFrame.new(0, 1.30701828, -0.629077435, 1, 0, 0, 0, 0.438599855, 0.898682296, 0, -0.898682296, 0.438599855),i)
761
						runservice.Stepped:wait()
762
					end
763
				end
764
			elseif rootpart.Velocity.y < -135 then
765
				fallingtodeath = true
766
				local action = Instance.new("BoolValue", character)
767
				action.Name = "FALLING"
768
				local i = 0
769
				while runservice.Stepped:wait() do
770
					fallingsound.Volume = fallingsound.Volume + 0.06
771
					i = i + 1
772
					humanoidrootpart.C0 = humanoidrootpart.C0 * CFrame.fromEulerAnglesXYZ(math.rad(1.5),math.rad(0.5),math.rad(1))
773
					head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.Angles(math.rad(-10),0,0) * CFrame.new(0,0.5,0),0.2)
774
					leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/5)*1.8,0,math.cos(i/5)/1.5) * CFrame.new(0,-0.7,0),0.2)
775
					rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(math.pi/2+math.sin(i/4.5)*1.8,0,-math.cos(i/5)/1.5) * CFrame.new(0,-0.7,0),0.2)
776
					leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(i/5)/2,0) * CFrame.Angles(-math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.2)
777
					rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1+math.cos(i/5)/2,0) * CFrame.Angles(math.sin(i/5),0,0) * CFrame.new(0,-1,0),0.2)
778
					--print('death falling')
779
				end
780
			end
781
		end
782
	end
783
end)()
784
while runservice.Stepped:wait() do
785
	if cananimate and not fallingtodeath then
786
		runsound.Volume = 0
787
		if anim == "idle" then
788
			head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(-5),0) * CFrame.new(0,0.5,0),0.2)
789
			leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
790
			rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
791
			humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(5),0),0.2)
792
			leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-5)-math.sin(tick())/20) * CFrame.new(0,-0.5,0),0.2)
793
			rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(5)+math.sin(tick())/20) * CFrame.new(0,-0.5,0),0.2)
794
		elseif anim == "walk" then
795
			runsound.Volume = 0.4
796
			runsound.PlaybackSpeed = 1.1
797
			head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.5,0),0.2)
798
			leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*12)/4,-math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*12)*1.5,0,0) * CFrame.new(0,-1,0),0.2)
799
			rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*12)/4,math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*12)*1.5,0,0) * CFrame.new(0,-1,0),0.2)
800
			humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.sin(tick()*24)/12,0) * CFrame.fromEulerAnglesXYZ(-math.rad(5),0,0),0.2)
801
			leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.3+math.sin(tick()*12)/3,-0.2+math.sin(tick()*12)/2) * CFrame.fromEulerAnglesXYZ(math.rad(40)-math.sin(tick()*12)*2,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.5,0),0.2)
802
			rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.3-math.sin(tick()*12)/3,-0.2-math.sin(tick()*12)/2) * CFrame.fromEulerAnglesXYZ(math.rad(40)+math.sin(tick()*12)*2,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.5,0),0.2)
803
		elseif anim == "run" then
804
			runsound.Volume = 1
805
			runsound.PlaybackSpeed = 1.4
806
			head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(10),0,0) * CFrame.new(0,0.5,0),0.2)
807
			leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1+math.cos(tick()*12)/2,-math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*12)*1.4,0,0) * CFrame.new(0,-1,0),0.2)
808
			rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick()*12)/2,math.cos(tick()*12)/1.5) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*12)*1.4,0,0) * CFrame.new(0,-1,0),0.2)
809
			humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,-0.2+math.sin(tick()*24)/10,0) * CFrame.fromEulerAnglesXYZ(0,math.rad(-rootpart.Orientation.y),0) * CFrame.fromEulerAnglesXYZ(humanoid.MoveDirection.z/5,0,-humanoid.MoveDirection.x/5) * CFrame.fromEulerAnglesXYZ(0,math.rad(rootpart.Orientation.y),0) * CFrame.fromEulerAnglesXYZ(-math.rad(10),0,0),0.2)
810
			leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10)-math.sin(tick()*12)*1.9,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.7,0),0.2)
811
			rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(10)+math.sin(tick()*12)*1.9,0,-math.sin(tick()*12)/2.5) * CFrame.new(0,-0.7,0),0.2)
812
		elseif anim == "jumprun" or anim == "fallrun" then
813
			if not roll then
814
				head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(20),0,0) * CFrame.new(0,0.5,0),0.2)
815
				leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(math.sin(tick()*2),0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
816
				rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1-math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(-math.sin(tick()*2),0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
817
				humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(math.rad(-20),0,0),0.2)
818
				leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-math.pi/3+math.sin(tick()*2)/5,0,math.cos(tick()*2)/5) * CFrame.new(0,-0.5,0),0.2)
819
				rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2+math.rad(20)+math.sin(tick()*2)/5,0,-math.cos(tick()*2)/5) * CFrame.new(0,-0.5,0),0.2)
820
			else
821
				head.C0 = head.C0:lerp(CFrame.new(0, 1.38302183, -0.321395874, 1, 0, 0, 0, 0.766044259, 0.642787695, 0, -0.642787695, 0.766044259),0.2)
822
				leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5, -2.00000048, 3.81469727e-06, 1, 0, 0, 0, 0.99999994, 0, 0, 1.49011612e-08, 1),0.2)
823
				rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5, -2.00000048, 3.81469727e-06, 1, 0, 0, 0, 0.99999994, 0, 0, 1.49011612e-08, 1),0.2)
824
				humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.984807789, 0.17364797, 0, -0.17364797, 0.984807789),0.2)
825
				leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.18301296, -0.0232186317, -0.439029694, 0.866025329, -0.49999997, 0, 0.383022159, 0.663413882, -0.642787457, 0.321393758, 0.556670368, 0.766044438),0.2)
826
				rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.18301296, -0.0232186317, -0.439029694, 0.866025388, 0.5, 0, -0.3830221, 0.663413823, -0.642787635, -0.321393877, 0.556670487, 0.766044259),0.2)
827
			end
828
		elseif anim == "jump" or anim == "fall" then
829
			head.C0 = head.C0:lerp(CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.5,0),0.2)
830
			leftleg.C0 = leftleg.C0:lerp(CFrame.new(-0.5,0,-0.5) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(-2)) * CFrame.new(0,-1,0),0.2)
831
			rightleg.C0 = rightleg.C0:lerp(CFrame.new(0.5,-1,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(2)) * CFrame.new(0,-1,0),0.2)
832
			humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(0,math.cos(tick())/15,0) * CFrame.fromEulerAnglesXYZ(0,0,0),0.2)
833
			leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi-math.rad(30),0,0) * CFrame.new(0,-0.5,0),0.2)
834
			rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi-math.rad(30),0,0) * CFrame.new(0,-0.5,0),0.2)
835
		end
836
	end
837
end