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