View difference between Paste ID: 3tXH4zJg and bgWWXEma
SHOW: | | - or go back to the newest paste.
1-
local player = game:service("Players").LocalPlayer
1+
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
2-
local mouse = player:GetMouse()
2+
local Player,Mouse,mouse,UserInputService,ContextActionService = owner
3
do
4
	print("FE Compatibility code by Mokiros")
5
	script.Parent = Player.Character
6
7
	--RemoteEvent for communicating
8
	local Event = Instance.new("RemoteEvent")
9
	Event.Name = "UserInput_Event"
10
11
	--Fake event to make stuff like Mouse.KeyDown work
12
	local function fakeEvent()
13
		local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
14
		t.connect = t.Connect
15
		return t
16
	end
17
18
	--Creating fake input objects with fake variables
19
    local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
20
	local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
21
	local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
22
		CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
23
	end}
24
	--Merged 2 functions into one by checking amount of arguments
25
	CAS.UnbindAction = CAS.BindAction
26
27
	--This function will trigger the events that have been :Connect()'ed
28
	local function te(self,ev,...)
29
		local t = m[ev]
30
		if t and t._fakeEvent and t.Function then
31
			t.Function(...)
32
		end
33
	end
34
	m.TrigEvent = te
35
	UIS.TrigEvent = te
36
37
	Event.OnServerEvent:Connect(function(plr,io)
38
	    if plr~=Player then return end
39
		if io.isMouse then
40
			m.Target = io.Target
41
			m.Hit = io.Hit
42
		else
43
			local b = io.UserInputState == Enum.UserInputState.Begin
44
			if io.UserInputType == Enum.UserInputType.MouseButton1 then
45
				return m:TrigEvent(b and "Button1Down" or "Button1Up")
46
			end
47
			for _,t in pairs(CAS.Actions) do
48
				for _,k in pairs(t.Keys) do
49
					if k==io.KeyCode then
50
						t.Function(t.Name,io.UserInputState,io)
51
					end
52
				end
53
			end
54
			m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
55
			UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
56
	    end
57
	end)
58
	Event.Parent = NLS([==[
59
	local Player = game:GetService("Players").LocalPlayer
60
	local Event = script:WaitForChild("UserInput_Event")
61
62
	local UIS = game:GetService("UserInputService")
63
	local input = function(io,a)
64
		if a then return end
65
		--Since InputObject is a client-side instance, we create and pass table instead
66
		Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
67
	end
68
	UIS.InputBegan:Connect(input)
69
	UIS.InputEnded:Connect(input)
70
71
	local Mouse = Player:GetMouse()
72
	local h,t
73
	--Give the server mouse data 30 times every second, but only if the values changed
74
	--If player is not moving their mouse, client won't fire events
75
	while wait(1/30) do
76
		if h~=Mouse.Hit or t~=Mouse.Target then
77
			h,t=Mouse.Hit,Mouse.Target
78
			Event:FireServer({isMouse=true,Target=t,Hit=h})
79
		end
80
	end]==],Player.Character)
81
	Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
82
end
83
84
local player = owner
85
local cam = workspace.CurrentCamera
86
local char = player.Character
87
local Torsoz = char:findFirstChild("Torso")
88
local RA = char:findFirstChild("Right Arm")
89
local LA = char:findFirstChild("Left Arm")
90
local RL = char:findFirstChild("Right Leg")
91
local LL = char:findFirstChild("Left Leg")
92
local H = char:findFirstChild("Head")
93
local Hu = char:findFirstChild("Humanoid")
94
local RS = Torsoz:findFirstChild("Right Shoulder")
95
local LS = Torsoz:findFirstChild("Left Shoulder")
96
local RH = Torsoz:findFirstChild("Right Hip")
97
local LH = Torsoz:findFirstChild("Left Hip")
98
local N = Torsoz:findFirstChild("Neck")
99
local NV = Vector3.new(0,0,0)
100
local FOV = 70
101
local Shift, Space, Sitting = false,false,false
102
local GravPoint = 0
103
local Diving = false
104
local DivingCooldown = 0
105
local DivingDir = NV
106
local DivingCF = CFrame.new(0,0,0)
107
local DivingBG, DivingBV
108
local HWallRunning = false
109
local HWRGravDrop = false
110
local HWRLastPart
111
local HWRCooldown = 0
112
local HWRDir
113
local VWallRunning = false
114
local VWRLastPart
115
local VWRCooldown = 0
116
local VWRLeft,VWRRight = false,false
117
local Sliding = false
118
local SlideCooldown = 0
119
local Standing = true
120
local Action = "Standing"
121
local animplus = true
122
local animspeed = 0
123
local animangle = 0.01
124
local Joint1, Joint2, Joint3, Joint4, Joint5
125
 
126
for i, v in pairs(char:children()) do
127
if (v.className == "LocalScript" and v.Name == "ParkourSkrip") or v.className == "NumberValue" or v.className == "BoolValue" or v.className == "Model" or v.Name == "Animate" then
128
v:remove()
129
end
130
end
131
 
132
local loadids = {112474909, 112474911, 112474909}
133
 
134
local stamina = 10000
135
local maxstamina = 10000
136
local defsprint = 28
137
local sprint = defsprint  
138
 
139
local pause = Instance.new("BoolValue", char)
140
pause.Name = "Pause"
141
pause.Value = false
142
local flow = Instance.new("NumberValue", char)
143
flow.Name = "Flow"
144
flow.Value = 0
145
local flowcooldown = 0
146
 
147
local m = Instance.new("Model", char)
148
m.Name = "FlowChainPartz"
149
 
150
local P = Instance.new("Part")
151
P.Name = "TrailPart"
152
P.formFactor = "Custom"
153
P.Size = Vector3.new(0.2,0.2,0.2)
154
P.Locked = true
155
P.Anchored = true
156
P.CanCollide = false
157
P.TopSurface = 0
158
P.BottomSurface = 0
159
 
160
script.Name = "ParkourSkrip"
161
 
162
local hue = 0
163
 
164
function HSV(H,S,V)
165
H = H % 360
166
local C = V * S
167
local H2 = H/60
168
local X = C * (1 - math.abs((H2 %2) -1))
169
local color = Color3.new(0,0,0)
170
if H2 <= 0 then
171
color = Color3.new(C,0,0)
172
elseif 0 <= H2 and H2 <= 1 then
173
color = Color3.new(C,X,0)
174
elseif 1 <= H2 and H2 <= 2 then
175
color = Color3.new(X,C,0)
176
elseif 2 <= H2 and H2 <= 3 then
177
color = Color3.new(0,C,X)
178
elseif 3 <= H2 and H2 <= 4 then
179
color = Color3.new(0,X,C)
180
elseif 4 <= H2 and H2 <= 5 then
181
color = Color3.new(X,0,C)
182
elseif 5 <= H2 and H2 <= 6 then
183
color = Color3.new(C,0,X)
184
end
185
local m = V - C
186
return Color3.new(color.r + m, color.g + m, color.b + m)
187
end
188
 
189
function GetWeld(weld)
190
if weld:findFirstChild("XAngle") == nil then
191
local a = Instance.new("NumberValue", weld)
192
a.Name = "XAngle"
193
end
194
if weld:findFirstChild("YAngle") == nil then
195
local a = Instance.new("NumberValue", weld)
196
a.Name = "YAngle"
197
end
198
if weld:findFirstChild("ZAngle") == nil then
199
local a = Instance.new("NumberValue", weld)
200
a.Name = "ZAngle"
201
end
202
return weld.C0.p, Vector3.new(weld.XAngle.Value, weld.YAngle.Value, weld.ZAngle.Value)
203
end
204
 
205
function SetWeld(weld, i, loops, origpos,origangle, nextpos,nextangle)
206
if weld:findFirstChild("XAngle") == nil then
207
local a = Instance.new("NumberValue", weld)
208
a.Name = "XAngle"
209
end
210
if weld:findFirstChild("YAngle") == nil then
211
local a = Instance.new("NumberValue", weld)
212
a.Name = "YAngle"
213
end
214
if weld:findFirstChild("ZAngle") == nil then
215
local a = Instance.new("NumberValue", weld)
216
a.Name = "ZAngle"
217
end
218
 
219
local tox,toy,toz = 0,0,0
220
if origangle.x > nextangle.x then
221
tox = -math.abs(origangle.x - nextangle.x) /loops*i
222
else
223
tox = math.abs(origangle.x - nextangle.x) /loops*i
224
end
225
if origangle.y > nextangle.y then
226
toy = -math.abs(origangle.y - nextangle.y) /loops*i
227
else
228
toy = math.abs(origangle.y - nextangle.y) /loops*i
229
end
230
if origangle.z > nextangle.z then
231
toz = -math.abs(origangle.z - nextangle.z) /loops*i
232
else
233
toz = math.abs(origangle.z - nextangle.z) /loops*i
234
end
235
 
236
local tox2,toy2,toz2 = 0,0,0
237
if origpos.x > nextpos.x then
238
tox2 = -math.abs(origpos.x - nextpos.x) /loops*i
239
else
240
tox2 = math.abs(origpos.x - nextpos.x) /loops*i
241
end
242
if origpos.y > nextpos.y then
243
toy2 = -math.abs(origpos.y - nextpos.y) /loops*i
244
else
245
toy2 = math.abs(origpos.y - nextpos.y) /loops*i
246
end
247
if origpos.z > nextpos.z then
248
toz2 = -math.abs(origpos.z - nextpos.z) /loops*i
249
else
250
toz2 = math.abs(origpos.z - nextpos.z) /loops*i
251
end
252
 
253
weld.XAngle.Value = origangle.x + tox
254
weld.YAngle.Value = origangle.y + toy
255
weld.ZAngle.Value = origangle.z + toz
256
weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz)
257
end
258
 
259
function LoadTextures()
260
local pls = game:service("ContentProvider")
261
for i, v in pairs(loadids) do
262
pls:Preload("http://www.roblox.com/asset/?id="..v)
263
wait(0.04)
264
end
265
end
266
LoadTextures()
267
 
268
function CreateGui()
269
for i, v in pairs(player.PlayerGui:children()) do
270
if v.className == "ScreenGui" and v.Name == "staminaGui" then
271
v:remove()
272
end
273
end
274
local g = Instance.new("ScreenGui", player.PlayerGui)
275
g.Name = "staminaGui"
276
 
277
local c = Instance.new("Frame", g)
278
c.Visible = false
279
c.Size = UDim2.new(0,86,0,320)
280
c.BackgroundTransparency = 1
281
c.Position = UDim2.new(1,-96,0.5,-160)
282
c.Name = "Container"
283
 
284
local t = Instance.new("TextLabel", c)
285
t.Size = UDim2.new(0,0,-0.1,0)
286
t.Position = UDim2.new(0.3,0,0.5,0)
287
t.TextXAlignment = "Right"
288
t.Font = "ArialBold"
289
t.TextTransparency = 0.1
290
t.TextColor3 = Color3.new(0,0.6,0.8)
291
t.TextStrokeColor3 = Color3.new(0,0.2,0.8)
292
t.TextStrokeTransparency = 0.3
293
t.FontSize = 6
294
t.BackgroundTransparency = 1
295
local t2 = t:Clone()
296
t2.Parent = c
297
t2.Size = UDim2.new(0,0,0.1,0)
298
local l = t:Clone()
299
l.Parent = c
300
l.Size = UDim2.new(0,0,0,0)
301
l.Text = "-----"
302
 
303
local f1 = Instance.new("Frame", c)
304
f1.Name = "Backing"
305
f1.ClipsDescendants = true
306
f1.Size = UDim2.new(1,0,0,0)
307
f1.BackgroundColor3 = Color3.new(0.8,0,0)
308
f1.BackgroundTransparency = 1
309
local f1img = Instance.new("ImageLabel", f1)
310
f1img.BackgroundTransparency = 1
311
f1img.Image = "http://www.roblox.com/asset/?id=112474909"
312
f1img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
313
 
314
local f2 = Instance.new("Frame", c)
315
f2.Name = "Overlay"
316
f2.ClipsDescendants = true
317
f2.Size = UDim2.new(1,0,1,0)
318
f2.BackgroundColor3 = Color3.new(0,0,0.8)
319
f2.BackgroundTransparency = 1
320
local f2img = Instance.new("ImageLabel", f2)
321
f2img.BackgroundTransparency = 1
322
f2img.Image = "http://www.roblox.com/asset/?id=112474911"
323
f2img.Size = UDim2.new(1,0,0,c.Size.Y.Offset)
324
 
325
function Calculate()
326
local ysize = c.Size.Y.Offset
327
local per = (stamina/maxstamina) * c.Size.Y.Offset
328
local rem = (-(stamina/maxstamina-1)) * c.Size.Y.Offset
329
f1.Size = UDim2.new(1,0,0,rem)
330
f2.Size = UDim2.new(1,0,0,per)
331
f2.Position = UDim2.new(0,0,0,rem)
332
f2img.Position = UDim2.new(0,0,0,-rem)
333
t.Text = math.floor(stamina)
334
t2.Text = maxstamina
335
end
336
Calculate()
337
 
338
wait(0.01)
339
c.Visible = true
340
end
341
CreateGui()
342
 
343
player.CharacterAdded:connect(function()
344
char = player.Character
345
Torsoz = char:findFirstChild("Torso")
346
RA = char:findFirstChild("Right Arm")
347
LA = char:findFirstChild("Left Arm")
348
RL = char:findFirstChild("Right Leg")
349
LL = char:findFirstChild("Left Leg")
350
H = char:findFirstChild("Head")
351
Hu = char:findFirstChild("Humanoid")
352
RS = Torsoz:findFirstChild("Right Shoulder")
353
LS = Torsoz:findFirstChild("Left Shoulder")
354
RH = Torsoz:findFirstChild("Right Hip")
355
LH = Torsoz:findFirstChild("Left Hip")
356
N = Torsoz:findFirstChild("Neck")
357
stamina = maxstamina
358
CreateGui()
359
end)
360
 
361
function RAY(pos, dir, startpos, endpos, distleft, collidedlist)
362
collidedlist = collidedlist or {char}
363
startpos = startpos or pos
364
distleft = distleft or dir.unit * dir.magnitude
365
endpos = endpos or pos + distleft
366
local ray = Ray.new(pos, distleft)
367
local hitz,enz = workspace:FindPartOnRayWithIgnoreList(ray, collidedlist)
368
--[[
369
local p = P:Clone()
370
p.Parent = char
371
p.Size = Vector3.new(0.4,0.4,0.4)
372
p.BrickColor = BrickColor.new("Lime green")
373
p.CanCollide = false
374
p.CFrame = CFrame.new(enz)
375
p.Transparency = 0.3
376
]]
377
if hitz ~= nil then
378
if hitz.CanCollide == false then
379
table.insert(collidedlist, hitz)
380
local newpos = enz
381
local newdistleft = distleft - (dir.unit * (pos - newpos).magnitude)
382
if newdistleft ~= NV then
383
return RAY(newpos-(dir*0.01), dir, startpos, endpos, newdistleft+(dir*0.01), collidedlist)
384
end
385
end
386
end
387
 
388
return hitz, enz, ray
389
end
390
 
391
function Sit()
392
Standing = false
393
local hitz,enz = RAY(Torsoz.Position, Vector3.new(0,-4.1,0))
394
local tordir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
395
if (hitz ~= nil and hitz.CanCollide == true) then
396
local cf = CFrame.new(enz+Vector3.new(0,1.28,0), enz+Vector3.new(0,1.28,0)+tordir) * CFrame.Angles(math.pi/6,0,0)
397
local hitz2,enz2 = RAY(enz+Vector3.new(0,2.25,0), tordir*-2.2)
398
Hu.PlatformStand = true
399
Torsoz.CFrame = cf
400
local bp = Instance.new("BodyPosition", Torsoz)
401
bp.Name = "StaminaBodyObject"
402
bp.maxForce = Vector3.new(1/0,1/0,1/0)
403
bp.D = 100
404
bp.position = cf.p
405
local bg = Instance.new("BodyGyro", Torsoz)
406
bg.Name = "StaminaBodyObject"
407
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
408
bg.cframe = cf
409
bg.D = 100
410
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.34,-1,0.2), Vector3.new((math.pi/2)-(math.pi/6),0,math.pi/8))
411
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.34,-1,0.2), Vector3.new((math.pi/2)-(math.pi/6),0,-math.pi/8))
412
 
413
if hitz2 ~= nil and hitz2.CanCollide == true then
414
Joint3.C0 = CFrame.new(0.9,0.4,-0.45) * CFrame.Angles(0,math.pi/2.13,0) * CFrame.Angles(math.pi/2.3,0,0)
415
Joint4.C0 = CFrame.new(-0.9,0.4,-0.4) * CFrame.Angles(0,-math.pi/2.05,0) * CFrame.Angles(math.pi/2.3,0,0)
416
Joint5.C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.pi/8.8,0,0)
417
else
418
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.4,0.1), Vector3.new(-(math.pi/6)-(math.pi/10),0,math.pi/9))
419
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.4,0.1), Vector3.new(-(math.pi/6)-(math.pi/10),0,-math.pi/9))
420
SetWeld(Joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(-math.pi/12,0,0))
421
end
422
 
423
Sitting = true
424
Action = "Sitting"
425
end
426
end
427
 
428
 
429
function Stand()
430
Hu.PlatformStand = false
431
if Sitting == true then
432
local tordir = Torsoz.Position + (Torsoz.CFrame.lookVector*10000)
433
local cf = CFrame.new(Torsoz.Position + Vector3.new(0,1.8,0), Vector3.new(tordir.x,Torsoz.Position.y,tordir.z))
434
Torsoz.CFrame = cf
435
end
436
for i, v in pairs(Torsoz:children()) do
437
if v.Name == "StaminaBodyObject" then
438
v:remove()
439
end
440
end
441
RH.Part0 = nil
442
LH.Part0 = nil
443
RS.Part0 = nil
444
LS.Part0 = nil
445
Joint1.Part0 = Torsoz
446
Joint1.Part1 = RL
447
Joint1.C0 = CFrame.new(0.5,-1,0)
448
Joint1.C1 = CFrame.new(0,1,0)
449
Joint2.Part0 = Torsoz
450
Joint2.Part1 = LL
451
Joint2.C0 = CFrame.new(-0.5,-1,0)
452
Joint2.C1 = CFrame.new(0,1,0)
453
Joint3.Part0 = Torsoz
454
Joint3.Part1 = RA
455
Joint3.C0 = CFrame.new(1.5,0.5,0)
456
Joint3.C1 = CFrame.new(0,0.5,0)
457
Joint4.Part0 = Torsoz
458
Joint4.Part1 = LA
459
Joint4.C0 = CFrame.new(-1.5,0.5,0)
460
Joint4.C1 = CFrame.new(0,0.5,0)
461
Joint5.Part0 = Torsoz
462
Joint5.Part1 = H
463
Joint5.C0 = CFrame.new(0,1,0)
464
Joint5.C1 = CFrame.new(0,-0.5,0)
465
Sitting = false
466
Diving = false
467
Standing = true
468
Action = "Standing"
469
end
470
 
471
--------------------------------------- Dive ----------------------------------
472
 
473
function Dive()
474
stamina = stamina - 10
475
flow.Value = flow.Value + 10
476
if flow.Value > 100 then
477
flow.Value = 100
478
end
479
Standing = false
480
local dir = Vector3.new(Torsoz.CFrame.lookVector.x,0,Torsoz.CFrame.lookVector.z)
481
GravPoint = 18
482
DivingDir = dir
483
local cf = CFrame.new(Torsoz.Position, dir+Vector3.new(0,Torsoz.Position.y,0))
484
DivingCF = cf
485
DivingDir = dir
486
Hu.PlatformStand = true
487
local bv = Instance.new("BodyVelocity", Torsoz)
488
bv.Name = "StaminaBodyObject"
489
bv.maxForce = Vector3.new(1/0,1/0,1/0)
490
bv.velocity = Vector3.new(DivingDir.x*24,GravPoint,DivingDir.z*24)
491
DivingBV = bv
492
local bg = Instance.new("BodyGyro", Torsoz)
493
bg.Name = "StaminaBodyObject"
494
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
495
bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+bv.velocity) * CFrame.Angles(-math.pi/2,0,0)
496
bg.D = 100
497
DivingBG = bg
498
 
499
local joint = Joint3
500
joint.C1 = CFrame.new(0,0.5,0)
501
local joint2 = Joint4
502
joint2.C1 = CFrame.new(0,0.5,0)
503
local joint3 = Joint1
504
joint3.C1 = CFrame.new(0,1,0)
505
local joint4 = Joint2
506
joint4.C1 = CFrame.new(0,1,0)
507
 
508
local joint5 = Joint5
509
 
510
Diving = true
511
Action = "Diving"
512
 
513
for i = 1, 8 do
514
SetWeld(joint,i,8, Vector3.new(1.5,0.5,0), NV, Vector3.new(1.45,0.5,0.1), Vector3.new(-0.2,-math.pi/9,math.pi/13))
515
SetWeld(joint2,i,8, Vector3.new(-1.5,0.5,0), NV, Vector3.new(-1.45,0.5,0.1), Vector3.new(-0.2,math.pi/9,-math.pi/13))
516
SetWeld(joint3,i,8, Vector3.new(0.5,-1,0), NV, Vector3.new(0.5,-1,0.03), Vector3.new(-0.2,-math.pi/10,math.pi/14))
517
SetWeld(joint4,i,8, Vector3.new(-0.5,-1,0), NV, Vector3.new(-0.5,-1,0.03), Vector3.new(-0.2,math.pi/10,-math.pi/14))
518
SetWeld(joint5,i,8, Vector3.new(0,1,0), NV, Vector3.new(0,1,0), Vector3.new(0.45,0,0))
519
wait(0.025)
520
end
521
 
522
local counter = 0
523
while Diving == true do
524
counter = counter + 1
525
bg.Parent = Torsoz
526
local hitz, enz = RAY(Torsoz.Position, bv.velocity.unit*4.6)
527
if hitz ~= nil and hitz.CanCollide == true then
528
local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-4,0))
529
if hitz2 ~= nil then
530
Diving = "Rolling"
531
Action = "DiveRolling"
532
else
533
Torsoz.CFrame = Torsoz.CFrame * CFrame.new(0,-0.3,0)
534
Torsoz.Velocity = NV
535
flow.Value = 0
536
break
537
end
538
end
539
if counter > 190 then
540
break
541
end
542
wait(0.02)
543
end
544
 
545
bv.velocity = (dir*20) + Vector3.new(0,-0.5,0)
546
 
547
local bgcf = bg.cframe
548
local haslanded = false
549
local count = 0
550
 
551
while haslanded == false do
552
bg.cframe = bgcf * CFrame.Angles(-0.3*count,0,0)
553
local hitz, enz = RAY(Torsoz.Position, ((Torsoz.CFrame*CFrame.new(0,-1,0)).p - Torsoz.CFrame.p).unit*1.6)
554
if hitz ~= nil and hitz.CanCollide == true then
555
haslanded = true
556
end
557
local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.8,0))
558
if hitz2 == nil then
559
Torsoz.Velocity = NV
560
break
561
elseif haslanded == true then
562
local bp = Instance.new("BodyPosition", Torsoz)
563
bp.Name = "StaminaJumpFix"
564
bp.maxForce = Vector3.new(0,1/0,0)
565
bp.P = 7000
566
bp.position = enz2 + Vector3.new(0,2.8,0)
567
game:service("Debris"):AddItem(bp, 0.3)
568
else
569
bv.velocity = (dir*20) + Vector3.new(0,-(Torsoz.Position - enz2).magnitude*3,0)
570
 
571
end
572
count = count + 1
573
if count <= 6 then
574
local i = count
575
local j1,j1a = GetWeld(joint)
576
local j2,j2a = GetWeld(joint2)
577
local j3,j3a = GetWeld(joint3)
578
local j4,j4a = GetWeld(joint4)
579
local j5,j5a = GetWeld(joint5)
580
SetWeld(joint,i,6, j1,j1a, Vector3.new(1.35,0.5,-0.2), Vector3.new(math.pi/2.6,0,-math.pi/5.8))
581
SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.35,0.5,-0.2), Vector3.new(math.pi/2.6,0,math.pi/5.8))
582
SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,0.4,-0.6), Vector3.new(-0.1,0,0.05))
583
SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,0.4,-0.6), Vector3.new(-0.1,0,-0.05))
584
SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.4,0,0))
585
elseif count >= 50 then
586
break
587
end
588
wait(0.02)
589
end
590
 
591
Torsoz.Velocity = NV
592
 
593
Stand()
594
DivingCooldown = 9
595
end
596
 
597
function FindSurface(part, position)
598
local obj = part.CFrame:pointToObjectSpace(position)
599
local siz = part.Size/2
600
for i,v in pairs(Enum.NormalId:GetEnumItems()) do
601
local vec = Vector3.FromNormalId(v)
602
local wvec = part.CFrame:vectorToWorldSpace(vec)
603
local vz = (obj)/(siz*vec)
604
if (math.abs(vz.X-1) < 0.01 or math.abs(vz.Y-1) < 0.01 or math.abs(vz.Z-1) < 0.01) then
605
return wvec,vec
606
end
607
end
608
if part.className == "WedgePart" then
609
return part.CFrame:vectorToWorldSpace(Vector3.new(0,0.707,-0.707)), Vector3.new(0,0.707,-0.707)
610
end
611
end
612
 
613
function HWallRun(part, pos, side)
614
if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
615
flow.Value = flow.Value + 9
616
Standing = false
617
HWallRunning = true
618
Action = "HWallRunning"
619
GravPoint = 10
620
HWRLastPart = part
621
local dir, dirc = FindSurface(part, pos)
622
towall = -dir
623
dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
624
 
625
local bv = Instance.new("BodyVelocity", Torsoz)
626
bv.Name = "StaminaBodyObject"
627
bv.maxForce = Vector3.new(1/0,1/0,1/0)
628
bv.P = 9000
629
bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
630
local bg = Instance.new("BodyGyro", Torsoz)
631
bg.Name = "StaminaBodyObject"
632
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
633
bg.cframe = CFrame.new(Torsoz.Position+(towall*-2), Torsoz.Position) * CFrame.Angles(0,-side,-side/4.2)
634
bg.D = 100
635
 
636
local sid = Instance.new("Snap")
637
 
638
local joint1 = Joint3
639
if side == -math.pi/2 then
640
SetWeld(joint1,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(math.pi/1.3,0.1,math.pi/2.5))
641
else
642
sid = joint1
643
SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.6,0), Vector3.new(-math.pi/12,0,math.pi/7))
644
end
645
local j1c0 = joint1.C0
646
 
647
local joint2 = Joint4
648
if side == math.pi/2 then
649
SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(math.pi/1.3,-0.1,-math.pi/2.5))
650
else
651
sid = joint2
652
SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.6,0), Vector3.new(-math.pi/12,0,-math.pi/7))
653
end
654
local j2c0 = joint2.C0
655
 
656
local joint3 = Joint1
657
joint3.C1 = CFrame.new(0,1,0)
658
if side == -math.pi/2 then
659
SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.38,-0.3), Vector3.new(0,math.pi/2,0.14))
660
else
661
SetWeld(joint3,1,1, NV,NV, Vector3.new(0.5,-0.8,-0.2), Vector3.new(0,math.pi/2,0.2))
662
end
663
 
664
local joint4 = Joint2
665
joint4.C1 = CFrame.new(0,1,0)
666
if side == -math.pi/2 then
667
SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.8,-0.2), Vector3.new(0,0,0.2))
668
else
669
SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.5,-0.38,-0.3), Vector3.new(0,0,0.14))
670
end
671
 
672
local joint5 = Joint5
673
SetWeld(joint5,1,1,NV,NV,Vector3.new(0,0.9,0),Vector3.new(0,0,side/7))
674
 
675
Torsoz.CFrame = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
676
bg.cframe = CFrame.new(pos+(towall*-2), pos) * CFrame.Angles(0,-side,-side/2.2)
677
 
678
local aniangle = 0
679
local aniplus = true
680
local aniangle2 = 0
681
local aniplus2 = true
682
 
683
local prevpart = part
684
HWRLastPart = part
685
while HWallRunning == true do
686
 
687
if aniangle > math.pi then
688
aniplus = false
689
elseif aniangle < -math.pi then
690
aniplus = true  
691
end
692
if aniplus == true then
693
aniangle = aniangle + 0.95
694
elseif aniplus == false then
695
aniangle = aniangle - 0.95
696
end
697
 
698
if aniangle2 > math.pi then
699
aniplus2 = false
700
elseif aniangle2 < -math.pi then
701
aniplus2 = true  
702
end
703
if aniplus2 == true then
704
aniangle2 = aniangle2 + 0.23
705
elseif aniplus2 == false then
706
aniangle2 = aniangle2 - 0.23
707
end
708
 
709
Hu.PlatformStand = true
710
local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3,0))
711
local hitz2, enz2 = RAY(Torsoz.Position, towall*3.4)
712
 
713
--- if player ends wall run on ground
714
if hitz ~= nil and hitz.CanCollide == true then
715
bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
716
local offset = (bg.cframe.p.y+enz2.y) - bg.cframe.p.y
717
Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
718
Torsoz.Velocity = NV
719
break
720
end
721
 
722
---- if new wall found --------
723
if hitz2 ~= nil and hitz2.CanCollide == true then
724
if hitz2 ~= prevpart then
725
local direct = CFrame.new(Torsoz.Position, Torsoz.Position+dir) * CFrame.Angles(0,side,0)
726
local hitz3, enz3 = RAY(Torsoz.Position, (direct * CFrame.Angles(0,-side/2.3,0)).lookVector*4)
727
if hitz3 ~= nil then
728
Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
729
bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side*1.1,-side/2.2)
730
dir, dirc = FindSurface(hitz2, enz2)
731
towall = -dir
732
dir = (CFrame.new(NV, dir) * CFrame.Angles(0,side,0)).lookVector
733
prevpart = hitz2
734
HWRLastPart = hitz2
735
else
736
---- if player fails to find new wall to run on
737
Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
738
bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
739
Torsoz.Velocity = NV
740
HWRCooldown = 5
741
break
742
end
743
end
744
--- continue to wall run
745
Torsoz.CFrame = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
746
bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,-side/2.2)
747
else
748
---- if player ends wall run at end of wall
749
Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
750
bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
751
Torsoz.Velocity = NV
752
HWRCooldown = 5
753
break
754
end
755
 
756
local hitz3, enz3 = RAY(Torsoz.Position, Torsoz.CFrame.lookVector*2)
757
if hitz3 ~= nil and hitz3.CanCollide == true then
758
Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
759
bg.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+dir)
760
Torsoz.Velocity = NV
761
HWRCooldown = 5
762
break
763
end
764
 
765
bv.Parent = Torsoz
766
bv.velocity = (dir*(sprint-0.5)) + Vector3.new(0,GravPoint,0)
767
bg.cframe = bg.cframe * CFrame.Angles(aniangle/80,aniangle/80,0)
768
Torsoz.CFrame = Torsoz.CFrame * CFrame.Angles(aniangle/80,aniangle/80,0)
769
local j3,j3a = GetWeld(joint3)
770
local j4,j4a = GetWeld(joint4)
771
SetWeld(joint3,1,1, j3,j3a, j3,Vector3.new(-0.2+(aniangle/4),0,0))
772
SetWeld(joint4,1,1, j4,j4a, j4,Vector3.new(-0.2+(-aniangle/4),0,0))
773
if side == math.pi/2 then
774
local j1,j1a = GetWeld(joint1)
775
SetWeld(joint1,1,1, j1,j1a, j1, Vector3.new(0,0,0.8+(aniangle2/14)))
776
else
777
local j2,j2a = GetWeld(joint2)
778
SetWeld(joint2,1,1, j2,j2a, j2, Vector3.new(0,0,-0.8-(aniangle2/14)))
779
end
780
 
781
wait(0.025)
782
if GravPoint < -100 then
783
bg.cframe = CFrame.new(enz2+(towall*-2), enz2) * CFrame.Angles(0,-side,0)
784
local offset = math.abs((bg.cframe.p.y+enz2.y) - bg.cframe.p.y)
785
Torsoz.CFrame = CFrame.new(Vector3.new(bg.cframe.p.x,offset,bg.cframe.p.z), enz2) * CFrame.Angles(0,-side,0)
786
break
787
end
788
 
789
end
790
 
791
if HWallRunning == "Jumping" then
792
HWRCooldown = 6
793
joint1.C1 = CFrame.new(0,0.5,0)
794
 
795
joint2.C1 = CFrame.new(0,0.5,0)
796
if side == -math.pi/2 then
797
joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/3)
798
else
799
joint2.C0 = CFrame.new(-1.35,0.5,0) * CFrame.Angles(0,side/2.4,-math.pi/4)
800
end
801
 
802
joint3.C1 = CFrame.new(0,1,0)
803
if side == -math.pi/2 then
804
joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),-math.pi/4)
805
else
806
joint3.C0 = CFrame.new(0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),math.pi/4)
807
end
808
joint4.MaxVelocity = 10
809
joint4.DesiredAngle = 0
810
joint4.C1 = CFrame.new(0,1,0)
811
if side == -math.pi/2 then
812
joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,math.pi+(side/2.4),math.pi/4)
813
else
814
joint4.C0 = CFrame.new(-0.5,-0.8,0) * CFrame.Angles(0,(side/2.4),-math.pi/4)
815
end
816
 
817
local joint5 = Joint5
818
joint5.C1 = CFrame.new(0,-0.5,0) * CFrame.Angles(0,side/2.4,0)
819
joint5.C0 = CFrame.new(0,1,0)
820
 
821
local j1,j1a = GetWeld(joint1)
822
local j2,j2a = GetWeld(joint2)
823
local j3,j3a = GetWeld(joint3)
824
local j4,j4a = GetWeld(joint4)
825
local j5,j5a = GetWeld(joint5)
826
 
827
GravPoint = 26
828
local collidecount = 0
829
local bgangle = side/2
830
local count = 1
831
local dir2 = (CFrame.new(NV, dir) * CFrame.Angles(0,-side/2.4,0)).lookVector
832
HWRDir = dir2
833
bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
834
while HWallRunning == "Jumping" do
835
local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-4,0))
836
local hitz2, enz2 = RAY(Torsoz.Position, dir2*1.4)
837
if hitz ~= nil and hitz.CanCollide == true then
838
local offset = math.abs(enz.y - Torsoz.CFrame.p.y)
839
Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2.9,0), enz+Vector3.new(0,2.9,0)+dir2)
840
Torsoz.Velocity = NV
841
break
842
end
843
 
844
if hitz2 ~= nil and hitz2.CanCollide == true then
845
collidecount = collidecount + 1
846
if collidecount == 4 then
847
Torsoz.CFrame = CFrame.new(Torsoz.Position, Torsoz.Position+dir2) * CFrame.new(0,0,0.4)
848
Torsoz.Velocity = Vector3.new(0,Torsoz.Velocity.y,0)
849
HWRCooldown = 5
850
VWRCooldown = 5
851
wait(0.02)
852
break
853
end
854
end
855
 
856
if side/2 > 0 then
857
if bgangle > 0.2 then
858
bgangle = bgangle - 0.055
859
end
860
else
861
if bgangle < -0.2 then
862
bgangle = bgangle + 0.055
863
end
864
end
865
 
866
if count <= 5 then
867
if side == -math.pi/2 then
868
SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/4))
869
SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/3))
870
SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
871
joint3.C0 = joint3.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
872
SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
873
joint4.C0 = joint4.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
874
else
875
SetWeld(joint1,count,5, j1,j1a, Vector3.new(1.35,0.5,0), Vector3.new(0,side/2.4,math.pi/3))
876
SetWeld(joint2,count,5, j2,j2a, Vector3.new(-1.35,0.5,0), Vector3.new(0,side/2.4,-math.pi/4))
877
SetWeld(joint3,count,5, j3,j3a, Vector3.new(0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
878
joint3.C0 = joint3.C0 * CFrame.Angles((math.pi/4)/5*count,0,0)
879
SetWeld(joint4,count,5, j4,j4a, Vector3.new(-0.5,-0.8,0), Vector3.new(0,-side/1.7,0))
880
joint4.C0 = joint4.C0 * CFrame.Angles((-math.pi/4)/5*count,0,0)
881
end
882
 
883
count = count + 1
884
end
885
 
886
bg.Parent = Torsoz
887
bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(0,side/15,-bgangle)
888
bv.velocity = (dir2*(sprint+5)) + Vector3.new(0,GravPoint,0)
889
if collidecount ~= 0 then
890
bv.velocity = Vector3.new(0,bv.velocity.y,0)
891
end
892
if GravPoint < -120 then
893
break
894
end
895
wait(0.025)
896
end
897
end
898
 
899
Hu.PlatformStand = false
900
bv:remove()
901
 
902
HWRGravDrop = false
903
Stand()
904
HWallRunning = false
905
end
906
end
907
 
908
function VWR(part, pos)
909
if (part.className == "Part" and part.Shape == Enum.PartType.Block) or part.className ~= "Part" then
910
print("VWR Activated")
911
flow.Value = flow.Value + 9
912
Standing = false
913
VWallRunning = true
914
Action = "VWallRunning"
915
GravPoint = 0
916
local percent = 1
917
VWRLastPart = part
918
local dir, dirc = FindSurface(part, pos)
919
towall = -dir
920
dir = (CFrame.new(NV, -dir) * CFrame.Angles(math.pi/2,0,0)).lookVector
921
--[[
922
local p = P:Clone()
923
p.Parent = char
924
p.Size = Vector3.new(2,2,2)
925
p.BrickColor = BrickColor.new("Lime green")
926
p.CanCollide = false
927
p.CFrame = part.CFrame * CFrame.new(dirc*5)
928
p.Transparency = 0.3
929
]]
930
local bv = Instance.new("BodyVelocity", Torsoz)
931
bv.Name = "StaminaBodyObject"
932
bv.maxForce = Vector3.new(1/0,1/0,1/0)
933
bv.P = 9000
934
bv.velocity = (dir*(sprint-1))*percent
935
 
936
local bg = Instance.new("BodyGyro", Torsoz)
937
bg.Name = "StaminaBodyObject"
938
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
939
bg.D = 100
940
local posi = pos + (-towall*1.8)
941
bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
942
Torsoz.CFrame = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0)
943
 
944
local joint1 = Joint3
945
SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,math.pi/8))
946
 
947
local joint2 = Joint4
948
SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,0,-math.pi/8))
949
 
950
local joint3 = Joint1
951
SetWeld(joint3,1,1, NV,NV, Vector3.new(0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
952
joint3.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
953
 
954
local joint4 = Joint2
955
SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.48,-0.6,-0.1), Vector3.new(0,math.pi/2,0))
956
joint4.C1 = CFrame.new(0,0.7,0.2) * CFrame.Angles(0,math.pi/2,0)
957
 
958
local joint5 = Joint5
959
SetWeld(joint5,1,1, NV,NV, Vector3.new(0,1,0), Vector3.new(math.pi/20,0,0))
960
 
961
local aniangle = 0
962
local aniplus = true
963
 
964
while VWallRunning == true do
965
local hitz, enz = RAY(Torsoz.Position, towall*2.1)
966
local hitz2, enz2 = RAY(Torsoz.Position, (CFrame.new(NV,towall)*CFrame.Angles(math.pi/2,0,0)).lookVector*2.4)
967
 
968
if aniangle > math.pi then
969
aniplus = false
970
elseif aniangle < -math.pi then
971
aniplus = true  
972
end
973
if aniplus == true then
974
aniangle = aniangle + (1.3*(percent+0.2))
975
elseif aniplus == false then
976
aniangle = aniangle - (1.3*(percent+0.2))
977
end
978
 
979
bv.velocity = (dir*(sprint-1))*percent
980
if VWRLeft == true then
981
bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
982
end
983
if VWRRight == true then
984
bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * (11*percent+5))
985
end
986
 
987
bg.cframe = CFrame.new(posi, posi+towall) * CFrame.Angles((math.pi/5),0,0) * CFrame.Angles(0,aniangle/60,0)
988
 
989
SetWeld(joint1,1,1, NV,NV, Vector3.new(1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,aniangle/52,(math.pi/8)+(aniangle/30)))
990
SetWeld(joint2,1,1, NV,NV, Vector3.new(-1.4,0.45,-0.1), Vector3.new(-math.pi/3.2,aniangle/52,(-math.pi/8)+(-aniangle/30)))
991
SetWeld(joint3,1,1, NV,NV, Vector3.new(0.51,-0.75,-(aniangle/30)), Vector3.new(0,math.pi/2,(aniangle/8)-0.3))
992
SetWeld(joint4,1,1, NV,NV, Vector3.new(-0.51,-0.75,(aniangle/30)), Vector3.new(0,math.pi/2,(-aniangle/8)-0.3))
993
 
994
if hitz == nil then
995
local lv = Torsoz.Position + (Torsoz.CFrame.lookVector*100)
996
Torsoz.CFrame = CFrame.new(Torsoz.Position, Vector3.new(lv.x,Torsoz.Position.y,lv.z))
997
break
998
end
999
 
1000
if hitz2 ~= nil then
1001
percent = 0
1002
VWallRunning = "Falling"
1003
Action = "VWRFalling"
1004
GravPoint = -7
1005
break
1006
end
1007
 
1008
wait(0.02)
1009
percent = percent - 0.028
1010
if percent <= 0.15 then
1011
VWallRunning = "Falling"
1012
Action = "VWRFalling"
1013
end
1014
end
1015
 
1016
-------------------------- Falling from VWR ------------------------------
1017
if VWallRunning == "Falling" then
1018
GravPoint = GravPoint - 1
1019
local dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
1020
bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
1021
 
1022
local j1,j1a = GetWeld(joint1)
1023
local j2,j2a = GetWeld(joint2)
1024
local j3,j3a = GetWeld(joint3)
1025
local j4,j4a = GetWeld(joint4)
1026
local j5,j5a = GetWeld(joint5)
1027
 
1028
local counter = 0
1029
while VWallRunning == "Falling" do
1030
counter = counter + 1
1031
local hitz, enz = RAY(H.Position, Vector3.new(0,-2.4,0))
1032
 
1033
dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
1034
bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
1035
if VWRLeft == true then
1036
bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
1037
end
1038
if VWRRight == true then
1039
bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
1040
end
1041
bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles(-math.pi/2.55,math.pi,0)
1042
 
1043
if counter <= 35 then
1044
SetWeld(joint1,counter,35, j1,j1a, Vector3.new(1.4,0.45,-0.1), Vector3.new(math.pi/9,0,math.pi/9))
1045
SetWeld(joint2,counter,35, j2,j2a, Vector3.new(-1.4,0.45,-0.1), Vector3.new(math.pi/9,0,-math.pi/9))
1046
SetWeld(joint3,counter,35, j3,j3a, Vector3.new(0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
1047
joint3.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
1048
SetWeld(joint4,counter,35, j4,j4a, Vector3.new(-0.5,-0.75,0), Vector3.new(0,math.pi/2,math.pi/9))
1049
joint4.C1 = CFrame.new(0,0.7 + (0.3/35*counter),0.2 - (0.2/35*counter)) * CFrame.Angles(0,math.pi/2,0)
1050
SetWeld(joint5,counter,35, j5,j5a, Vector3.new(0,1,0), Vector3.new(-math.pi/6,0,0))
1051
end
1052
 
1053
if hitz ~= nil then
1054
bv:remove()
1055
Torsoz.CFrame = CFrame.new(enz+Vector3.new(0,2,0), (enz+Vector3.new(0,2,0)) + ((-towall*25) + Vector3.new(0,GravPoint,0))) * CFrame.Angles(-math.pi/2.55,math.pi,0)
1056
Torsoz.Velocity = NV
1057
Torsoz.RotVelocity = NV
1058
local bp = Instance.new("BodyPosition", Torsoz)
1059
bp.maxForce = Vector3.new(1/0,1/0,1/0)
1060
bp.position = Torsoz.CFrame.p
1061
game:service("Debris"):AddItem(bp, 0.16)
1062
flow.Value = 0
1063
break
1064
end
1065
 
1066
if GravPoint > - 180 then
1067
GravPoint = GravPoint - 1.9
1068
end
1069
if counter > 200 then
1070
break
1071
end
1072
wait(0.02)
1073
end
1074
 
1075
local bp = Instance.new("BodyPosition")
1076
 
1077
local counter2 = counter
1078
local bgangleplus = 0
1079
 
1080
local j1,j1a = GetWeld(joint1)
1081
local j2,j2a = GetWeld(joint2)
1082
local j3,j3a = GetWeld(joint3)
1083
local j4,j4a = GetWeld(joint4)
1084
local j5,j5a = GetWeld(joint5)
1085
 
1086
local landingpos
1087
 
1088
while VWallRunning == "BackflipFromFall" do
1089
counter2 = counter2 + 1
1090
local hitz, enz = RAY(H.Position+Vector3.new(0,2,0), Vector3.new(0,-4.4,0))
1091
 
1092
if counter2 - counter < 13 then
1093
bgangleplus = bgangleplus - ((math.pi*1.1)/13)
1094
end
1095
if counter2 - counter <= 13 then
1096
SetWeld(joint1,counter2-counter,13, j1,j1a, Vector3.new(1.4,0.5,0.1), Vector3.new(math.pi/2,0.1,math.pi/2))
1097
SetWeld(joint2,counter2-counter,13, j2,j2a, Vector3.new(-1.4,0.5,0.1), Vector3.new(math.pi/2,-0.1,-math.pi/2))
1098
SetWeld(joint3,counter2-counter,13, j3,j3a, Vector3.new(0.52,-0.3,-0.65), Vector3.new(0,math.pi/2,0))
1099
SetWeld(joint4,counter2-counter,13, j4,j4a, Vector3.new(-0.51,-0.9,-0.05), Vector3.new(0,math.pi/2,0))
1100
SetWeld(joint5,counter2-counter,13, j5,j5a, Vector3.new(0,0.9,0), Vector3.new(-math.pi/7,0,0))
1101
end
1102
 
1103
dirpos = (-towall *5) + Vector3.new(0,GravPoint,0)
1104
--bv.velocity = Vector3.new(0,-2,0)
1105
bv.velocity = CFrame.new(NV, dirpos).lookVector * dirpos.magnitude
1106
if VWRLeft == true then
1107
bv.velocity = bv.velocity + ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
1108
end
1109
if VWRRight == true then
1110
bv.velocity = bv.velocity - ((CFrame.new(NV, towall) * CFrame.Angles(0,math.pi/2,0)).lookVector * 9)
1111
end
1112
bg.cframe = CFrame.new(NV, (-towall*30) + Vector3.new(0,GravPoint,0)) * CFrame.Angles((-math.pi/2.4) + bgangleplus,math.pi,0)
1113
 
1114
if hitz ~= nil then
1115
bv:remove()
1116
landingpos = enz - (towall*1.3)
1117
if counter2 - counter > 8 then
1118
bp = Instance.new("BodyPosition", Torsoz)
1119
bp.maxForce = Vector3.new(1/0,1/0,1/0)
1120
bp.position = enz+Vector3.new(0,2.4,0) + (-towall*1)
1121
VWallRunning = "LandingFall"
1122
else
1123
Torsoz.CFrame = bg.cframe + (enz+Vector3.new(0,2.3,0))
1124
Torsoz.Velocity = NV
1125
Torsoz.RotVelocity = NV
1126
local bp = Instance.new("BodyPosition", Torsoz)
1127
bp.maxForce = Vector3.new(1/0,1/0,1/0)
1128
bp.position = Torsoz.CFrame.p
1129
game:service("Debris"):AddItem(bp, 0.14)
1130
flow.Value = 0
1131
end
1132
break
1133
end
1134
 
1135
if GravPoint > - 180 then
1136
GravPoint = GravPoint - 1.9
1137
end
1138
if counter2 > 200 then
1139
break
1140
end
1141
wait(0.02)
1142
end
1143
 
1144
if VWallRunning == "LandingFall" then
1145
print("Landing")
1146
 
1147
joint3.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
1148
joint4.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
1149
local j1,j1a = GetWeld(joint1)
1150
local j2,j2a = GetWeld(joint2)
1151
local j3,j3a = GetWeld(joint3)
1152
local j4,j4a = GetWeld(joint4)
1153
local j5,j5a = GetWeld(joint5)
1154
 
1155
local a
1156
local mesh
1157
if GravPoint < -70 then
1158
a = P:Clone()
1159
a.Parent = Torsoz
1160
a.Name = "AirLandingEffect"
1161
a.BrickColor = BrickColor.new("Medium stone grey")
1162
a.Transparency = 0.3
1163
a.CFrame = CFrame.new(landingpos+Vector3.new(0,0.4,0))
1164
mesh = Instance.new("SpecialMesh", a)
1165
mesh.MeshId = "http://www.roblox.com/asset/?id=20329976"
1166
mesh.Scale = Vector3.new(0,0,0)
1167
end
1168
 
1169
local bgcf = CFrame.new(NV, Vector3.new(towall.x,0,towall.z))
1170
bg.cframe = bgcf * CFrame.Angles(-math.pi/7,0,0)
1171
local bgval = math.pi/7/2
1172
 
1173
for i = 1, 6 do
1174
Hu.PlatformStand = true
1175
SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.2,0.5,0.2), Vector3.new(math.pi/2,0.5,math.pi/1.2))
1176
SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.2,0.5,0.2), Vector3.new(math.pi/2,-0.5,-math.pi/1.2))
1177
SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.51,-0.3,-0.8), Vector3.new(0,math.pi/2,-math.pi/7))
1178
SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.51,-0.8,-0.7), Vector3.new(0,math.pi/2,-math.pi/3))
1179
SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,0.85,0), Vector3.new(-math.pi/8,0,0))
1180
bp.position = bp.position + Vector3.new(0,-0.07,0)
1181
bg.cframe = bgcf * CFrame.Angles((-bgval*2) + (bgval/6*i),0,0)
1182
Torsoz.CFrame = bg.cframe + bp.position
1183
if a ~= nil then
1184
mesh.Scale = mesh.Scale + Vector3.new(1.3,0.35,1.3)
1185
a.Transparency = 0.3 + (0.7/6*i)
1186
end
1187
wait(0.02)
1188
end
1189
if a ~= nil then
1190
a:remove()
1191
end
1192
local j1,j1a = GetWeld(joint1)
1193
local j2,j2a = GetWeld(joint2)
1194
local j3,j3a = GetWeld(joint3)
1195
local j4,j4a = GetWeld(joint4)
1196
local j5,j5a = GetWeld(joint5)
1197
for i = 1, 6 do
1198
Hu.PlatformStand = true
1199
SetWeld(joint1,i,6, j1,j1a, Vector3.new(1.5,0.5,0), Vector3.new(0,0,0))
1200
SetWeld(joint2,i,6, j2,j2a, Vector3.new(-1.5,0.5,0), Vector3.new(0,0,0))
1201
SetWeld(joint3,i,6, j3,j3a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
1202
SetWeld(joint4,i,6, j4,j4a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
1203
SetWeld(joint5,i,6, j5,j5a, Vector3.new(0,1,0), Vector3.new(0,0,0))
1204
bp.position = bp.position + Vector3.new(0,0.1,0)
1205
bg.cframe = bgcf * CFrame.Angles(-bgval + (bgval/6*i),0,0)
1206
Torsoz.CFrame = bg.cframe + bp.position
1207
wait(0.02)
1208
end
1209
 
1210
bp:remove()
1211
end
1212
 
1213
end
1214
 
1215
bv:remove()
1216
bg:remove()
1217
VWallRunning = false
1218
Stand()
1219
end
1220
end
1221
 
1222
function Slide(pos)
1223
flow.Value = flow.Value + 6
1224
Action = "Sliding"
1225
Sliding = true
1226
GravPoint = Torsoz.Velocity.y
1227
local spd = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude + 10
1228
local dir = Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).unit
1229
 
1230
local bv = Instance.new("BodyVelocity", Torsoz)
1231
bv.maxForce = Vector3.new(1/0,1/0,1/0)
1232
bv.velocity = dir*spd
1233
local bg = Instance.new("BodyGyro", Torsoz)
1234
bg.maxTorque = Vector3.new(1/0,1/0,1/0)
1235
bg.cframe = CFrame.new(NV, dir) * CFrame.Angles(math.pi/2.2,0.24,0)
1236
 
1237
local joint1 = Joint1
1238
local joint2 = Joint2
1239
local joint3 = Joint3
1240
local joint4 = Joint4
1241
local joint5 = Joint5
1242
local j1,j1a = GetWeld(joint1)
1243
local j2,j2a = GetWeld(joint2)
1244
 
1245
SetWeld(joint1,1,1, NV,NV, Vector3.new(j1.x,j1.y,j1.z), Vector3.new(j1a.x,math.pi/2,j1a.z))
1246
joint1.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
1247
SetWeld(joint2,1,1, NV,NV, Vector3.new(j2.x,j2.y,j2.z), Vector3.new(j2a.x,math.pi/2,j2a.z))
1248
joint2.C1 = CFrame.new(0,1,0) * CFrame.Angles(0,math.pi/2,0)
1249
 
1250
local j1,j1a = GetWeld(joint1)
1251
local j2,j2a = GetWeld(joint2)
1252
local j3,j3a = GetWeld(joint3)
1253
local j4,j4a = GetWeld(joint4)
1254
local j5,j5a = GetWeld(joint5)
1255
 
1256
local count = 0
1257
local lastpos
1258
 
1259
while Sliding == true do
1260
count = count + 1
1261
Hu.PlatformStand = true
1262
local hitz1, enz1 = RAY(Torsoz.Position+Vector3.new(0,0.03,0), dir *2.5)
1263
local hitz2, enz2 = RAY(Torsoz.Position-Vector3.new(0,0.2,0), dir *2.5)
1264
local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
1265
bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
1266
 
1267
if count <= 5 then
1268
SetWeld(joint1,count,5, j1,j1a, Vector3.new(0.5,-0.8,-0.15), Vector3.new(0,(math.pi/2)+0.1,-0.4))
1269
SetWeld(joint2,count,5, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,(math.pi/2)-0.4,0))
1270
SetWeld(joint3,count,5, j3,j3a, Vector3.new(1.5,0.5,0), Vector3.new(-0.7,-0.24,math.pi/5))
1271
SetWeld(joint4,count,5, j4,j4a, Vector3.new(-1.5,0.5,0), Vector3.new(-0.1,0,-math.pi/1.5))
1272
SetWeld(joint5,count,5, j5,j5a, Vector3.new(0,1,0), Vector3.new(-0.5,-0.2,0))
1273
end
1274
 
1275
if (hitz1 ~= nil and hitz1.CanCollide == true) or (hitz2 ~= nil and  hitz2.CanCollide == true) then
1276
bv:remove()
1277
bg:remove()
1278
Sliding = "HitObject"
1279
end
1280
if ghitz ~= nil then
1281
GravPoint = 0
1282
Torsoz.CFrame = CFrame.new(genz, genz+dir) * CFrame.Angles(math.pi/2.2,0.24,0) + Vector3.new(0,0.7,0)
1283
spd = spd - 0.95
1284
else
1285
if GravPoint > -180 then
1286
GravPoint = GravPoint - 5.6
1287
end
1288
spd = spd - 0.36
1289
end
1290
if spd < 7 then
1291
Sliding = false
1292
end
1293
wait(0.02)
1294
end
1295
 
1296
if Sliding == false then
1297
local j1,j1a = GetWeld(joint1)
1298
local j2,j2a = GetWeld(joint2)
1299
local j3,j3a = GetWeld(joint3)
1300
local j4,j4a = GetWeld(joint4)
1301
local j5,j5a = GetWeld(joint5)
1302
for i = 1, 4 do
1303
SetWeld(joint1,i,4, j1,j1a, Vector3.new(0.5,-1,0), Vector3.new(0,math.pi/2,0))
1304
SetWeld(joint2,i,4, j2,j2a, Vector3.new(-0.5,-1,0), Vector3.new(0,math.pi/2,0))
1305
SetWeld(joint3,i,4, j3,j3a, Vector3.new(1.5,0.5,0), NV)
1306
SetWeld(joint4,i,4, j4,j4a, Vector3.new(-1.5,0.5,0), NV)
1307
SetWeld(joint5,i,4, j5,j5a, Vector3.new(0,1,0), NV)
1308
local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
1309
bg.cframe = CFrame.new(NV, dir) * CFrame.Angles((math.pi/2.2) - ((math.pi/2.2)/4*i),0.24 - (0.24/4*i),0)
1310
bv.velocity = dir*spd + Vector3.new(0,GravPoint,0)
1311
 
1312
if hitz ~= nil then
1313
GravPoint = 0
1314
Torsoz.CFrame = CFrame.new(enz, enz+dir) * CFrame.Angles((math.pi/2.2) - ((math.pi/2.2)/4*i),0.24 - (0.24/4*i),0) + Vector3.new(0,0.7+(1.8/4*i),0)
1315
spd = spd - 0.95
1316
else
1317
if GravPoint > -180 then
1318
GravPoint = GravPoint - 5.6
1319
end
1320
spd = spd - 0.36
1321
end
1322
wait(0.02)
1323
end
1324
local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-2.6,0))
1325
Torsoz.CFrame = CFrame.new(enz, enz+dir) + Vector3.new(0,3,0)
1326
end
1327
bv:remove()
1328
bg:remove()
1329
SlideCooldown = 10
1330
Stand()
1331
end
1332
 
1333
function KD(key)
1334
if pause.Value == false then
1335
if key == string.char(32) then
1336
Space = true
1337
 
1338
local ghitz, genz = RAY(Torsoz.Position, Vector3.new(0,-3.7,0))
1339
local hitz, enz = RAY(Torsoz.Position+Vector3.new(0,1.1,0), Torsoz.CFrame.lookVector*2.3)
1340
local righthitz, rightenz
1341
local lefthitz, leftenz
1342
 
1343
if HWallRunning == false then
1344
righthitz, rightenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
1345
lefthitz, leftenz = RAY(Torsoz.Position, ((Torsoz.CFrame * CFrame.new(-1.5,0,-0.2)).p - Torsoz.CFrame.p).unit*3.9)
1346
 
1347
elseif HWallRunning == "Jumping" then
1348
righthitz, rightenz = RAY(Torsoz.Position, ((CFrame.new(Torsoz.Position, Torsoz.Position + HWRDir) * CFrame.new(1.5,0,-0.2)).p - Torsoz.Position).unit*3.9)
1349
lefthitz, leftenz = RAY(Torsoz.Position, ((CFrame.new(Torsoz.Position, Torsoz.Position + HWRDir) * CFrame.new(-1.5,0,-0.2)).p - Torsoz.Position).unit*3.9)
1350
 
1351
end
1352
 
1353
if Action == "Standing" and Shift == true and (hitz == nil or hitz.CanCollide == false) and (righthitz == nil or righthitz.CanCollide == false) and (lefthitz == nil or lefthitz.CanCollide == false) and (ghitz == nil or ghitz.CanCollide == false) and (Torsoz.Velocity.y > 6 and Torsoz.Velocity.y < 50) and DivingCooldown <= 0 then
1354
if stamina >= 10 then
1355
--if Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 12 then
1356
Dive()
1357
--end
1358
end
1359
end
1360
 
1361
if hitz == nil and VWallRunning == "Falling" then
1362
VWallRunning = "BackflipFromFall"
1363
end
1364
 
1365
if Shift == true and Torsoz.Velocity.y > -50 and Diving == false and DivingCooldown <= 0 then
1366
local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-3.5,0))
1367
 
1368
if hitz ~= nil then
1369
if Action == "Standing" and VWRCooldown == 0 then
1370
if hitz2 == nil or hitz2.CanCollide == false then
1371
VWR(hitz, enz)
1372
end
1373
end
1374
end
1375
 
1376
if (HWallRunning == false or (HWallRunning == "Jumping" and (HWRLastPart ~= righthitz or HWRLastPart ~= lefthitz))) and HWRCooldown == 0 and VWallRunning == false then
1377
 
1378
if (hitz == nil or HWallRunning == "Jumping") and ((righthitz ~= nil and righthitz.Parent:findFirstChild("Humanoid") == nil and righthitz.Parent.className ~= "Hat") or (lefthitz ~= nil and lefthitz.Parent:findFirstChild("Humanoid") == nil and lefthitz.Parent.className ~= "Hat")) then
1379
if hitz2 == nil or hitz2.CanCollide == false then
1380
local right = (rightenz - Torsoz.Position).magnitude
1381
local left = (leftenz - Torsoz.Position).magnitude
1382
if right < left then
1383
if HWallRunning == "Jumping" and HWRLastPart ~= righthitz then
1384
HWallRunning = false
1385
while Standing == false do
1386
wait(0.01)
1387
end
1388
print("2nd Right Activated!")
1389
HWallRun(righthitz, rightenz, -math.pi/2)
1390
else
1391
if hitz == nil then
1392
print("Right Activated")
1393
HWallRun(righthitz, rightenz, -math.pi/2)
1394
end
1395
end
1396
elseif left < right then
1397
if HWallRunning == "Jumping" and HWRLastPart ~= lefthitz then
1398
HWallRunning = false
1399
while Standing == false do
1400
wait(0.01)
1401
end
1402
print("2nd Left Activated!")
1403
HWallRun(lefthitz, leftenz, math.pi/2)
1404
else
1405
if hitz == nil then
1406
print("Left Activated")
1407
HWallRun(lefthitz, leftenz, math.pi/2)
1408
end
1409
end
1410
end
1411
end
1412
end
1413
end
1414
 
1415
end
1416
 
1417
if HWallRunning == true then
1418
HWallRunning = "Jumping"
1419
Action = "HWRJumping"
1420
end
1421
 
1422
elseif key == string.char(48) then
1423
Shift = true
1424
elseif key == string.char(50) then
1425
if Action == "Standing" then
1426
Sit()
1427
elseif HWallRunning == true then
1428
HWRGravDrop = true
1429
end
1430
elseif key == string.char(52) then
1431
if Shift == true and Action == "Standing" and SlideCooldown == 0 and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 15 and Torsoz.Velocity.y > -40 then
1432
print("Sliding")
1433
Slide()
1434
end
1435
elseif key == "a" then
1436
VWRLeft = true
1437
elseif key == "d" then
1438
VWRRight = true
1439
end
1440
end
1441
end
1442
 
1443
function KU(key)
1444
if key == string.char(32) then
1445
Space = false
1446
elseif key == string.char(48) then
1447
Shift = false
1448
elseif key == string.char(50) then
1449
if Action == "Sitting" then
1450
Stand()
1451
end
1452
elseif key == string.char(52) then
1453
Sliding = false
1454
elseif key == "a" then
1455
VWRLeft = false
1456
elseif key == "d" then
1457
VWRRight = false
1458
end
1459
end
1460
 
1461
mouse.KeyDown:connect(function(key) KD(key) end)
1462
mouse.KeyUp:connect(function(key) KU(key) end)
1463
 
1464
Joint1 = Instance.new("Snap", Torsoz)
1465
GetWeld(Joint1)
1466
Joint2 = Instance.new("Snap", Torsoz)
1467
GetWeld(Joint2)
1468
Joint3 = Instance.new("Snap", Torsoz)
1469
GetWeld(Joint3)
1470
Joint4 = Instance.new("Snap", Torsoz)
1471
GetWeld(Joint4)
1472
Joint5 = Instance.new("Snap", Torsoz)
1473
GetWeld(Joint5)
1474
Stand()
1475
 
1476
local animatebg = Instance.new("BodyGyro")
1477
animatebg.D = 100
1478
local GravAction = "Idle"
1479
local PrevGravAction = GravAction
1480
 
1481
local prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
1482
local prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
1483
local hue = 0
1484
local recyclecount = 0
1485
local tickoffset = tick()
1486
local fadetab = {}
1487
local fadetab2 = {}
1488
local animatebgcount = 0
1489
 
1490
for i = 1, 13 do
1491
local p = P:Clone()
1492
p.Name = "Part"..i
1493
local mesh = Instance.new("SpecialMesh", p)
1494
mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
1495
mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
1496
table.insert(fadetab, {p, mesh})
1497
end
1498
for i = 1, 13 do
1499
local p = P:Clone()
1500
p.Name = "Part"..i
1501
local mesh = Instance.new("SpecialMesh", p)
1502
mesh.MeshId = "http://www.roblox.com/Asset/?id=9856898"
1503
mesh.TextureId = "http://www.roblox.com/Asset/?id=48358980"
1504
table.insert(fadetab2, {p, mesh})
1505
end
1506
 
1507
game:service("RunService").Stepped:connect(function()
1508
GravAction = "Idle"
1509
hue = hue + 3
1510
hue = hue % 360
1511
 
1512
------------- anim angle changing --------
1513
if animangle > math.pi then
1514
animplus = false
1515
elseif animangle < -math.pi then
1516
animplus = true  
1517
end
1518
if animplus == true then
1519
animangle = animangle + animspeed
1520
elseif animplus == false then
1521
animangle = animangle - animspeed
1522
end
1523
 
1524
local hitz, enz = RAY(Torsoz.Position, Vector3.new(0,-3.9,0))
1525
if Shift == true then
1526
Hu.WalkSpeed = sprint
1527
else
1528
Hu.WalkSpeed = 16
1529
end
1530
if (FOV >= 70 and FOV < 74) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude > 25 then
1531
FOV = FOV + 1
1532
elseif (FOV <= 74 and FOV > 70) and Vector3.new(Torsoz.Velocity.x,0,Torsoz.Velocity.z).magnitude < 20 then
1533
FOV = FOV - 1
1534
end
1535
if pause.Value == true then
1536
Hu.WalkSpeed = 0
1537
end
1538
if Sitting == true then
1539
local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-2.2,0))
1540
Hu.PlatformStand = true
1541
if hitz2 == nil then
1542
Stand()
1543
end
1544
end
1545
if Diving == true then
1546
Hu.PlatformStand = true
1547
DivingBV.velocity = Vector3.new(DivingDir.x*(sprint+2),GravPoint,DivingDir.z*(sprint+2))
1548
DivingBG.cframe = CFrame.new(Torsoz.Position, Torsoz.Position+DivingBV.velocity) * CFrame.Angles(-math.pi/2,0,0)
1549
 
1550
if GravPoint > -180 then
1551
GravPoint = GravPoint - 2
1552
end
1553
end
1554
if DivingCooldown > 0 then
1555
DivingCooldown = DivingCooldown - 1
1556
end
1557
if HWallRunning == true then
1558
if HWRGravDrop == false then
1559
GravPoint = GravPoint - 0.4
1560
else
1561
GravPoint = GravPoint - 2
1562
end
1563
elseif HWallRunning == "Jumping" then
1564
GravPoint = GravPoint - 1.7
1565
end
1566
----------------------------- stamina ----------------------------------------
1567
if Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 18 and Action == "Standing" and Shift == true then
1568
if stamina > 0 then
1569
stamina = stamina - 0.5
1570
if stamina < 0 then
1571
Shift = false
1572
stamina = 0
1573
end
1574
else
1575
Shift = false
1576
stamina = 0
1577
end
1578
if Action == "Standing" then
1579
animspeed = 0.85
1580
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/4.85,0,0))
1581
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/4.85,0,0))
1582
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/3.5,0,0))
1583
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/3.5,0,0))
1584
end
1585
elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude > 12 and Action ~= "Sliding" then
1586
if stamina < maxstamina then
1587
stamina = stamina + 0.5
1588
if stamina > maxstamina then
1589
stamina = maxstamina
1590
end
1591
else
1592
stamina = maxstamina
1593
end
1594
if Action == "Standing" then
1595
animspeed = 0.65
1596
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/7,0,0))
1597
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/7,0,0))
1598
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/5,0,0))
1599
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/5,0,0))
1600
end
1601
elseif Vector3.new(Torsoz.Velocity.x, 0, Torsoz.Velocity.z).magnitude < 2 then
1602
animspeed = 0.1
1603
if Action == "Standing" then
1604
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
1605
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
1606
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new(animangle/30,0,0))
1607
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new(-animangle/30,0,0))
1608
end
1609
if stamina < maxstamina then
1610
if Sitting == false then
1611
stamina = stamina + 0.65
1612
else
1613
stamina = stamina + 1.02
1614
end
1615
if stamina > maxstamina then
1616
stamina = maxstamina
1617
end
1618
else
1619
stamina = maxstamina
1620
end
1621
end
1622
 
1623
if hitz == nil then
1624
if Torsoz.Velocity.y > 1 or (Torsoz.Velocity.y < -1 and Torsoz.Velocity.y > -90) then
1625
if Action == "Standing" then
1626
GravAction = "Rising"
1627
animspeed = 0.1
1628
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.5,-1,0), Vector3.new(-animangle/38,0,0))
1629
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.5,-1,0), Vector3.new(animangle/38,0,0))
1630
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.5,0.5,0), Vector3.new((math.pi-0.2)+(animangle/30),0,0))
1631
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.5,0.5,0), Vector3.new((math.pi-0.2)+(-animangle/30),0,0))
1632
if animatebg.Parent ~= nil then
1633
animatebg.Parent = Torsoz
1634
animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
1635
local lokvec = Torsoz.CFrame.lookVector*100
1636
animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
1637
animatebg.Parent = nil
1638
end
1639
end
1640
end
1641
end
1642
 
1643
if hitz == nil then
1644
local hitz2, enz2 = RAY(Torsoz.Position, Vector3.new(0,-6,0))
1645
if hitz2 == nil then
1646
if Torsoz.Velocity.y < -90 then
1647
if Action == "Standing" then
1648
GravAction = "Falling"
1649
animspeed = 1.1
1650
animatebg.Parent = Torsoz
1651
animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
1652
local lokvec = Torsoz.CFrame.lookVector*100
1653
animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z)) * CFrame.Angles(-math.pi/11,animangle/70,0)
1654
SetWeld(Joint1,1,1, NV,NV, Vector3.new(0.45,-0.8,0), Vector3.new((animangle/27)-0.3,0,0.18))
1655
SetWeld(Joint2,1,1, NV,NV, Vector3.new(-0.45,-0.8,0), Vector3.new((-animangle/27)-0.3,0,-0.18))
1656
SetWeld(Joint3,1,1, NV,NV, Vector3.new(1.4,0.5,0), Vector3.new((math.pi+0.2)+(animangle/26),0,0.18))
1657
SetWeld(Joint4,1,1, NV,NV, Vector3.new(-1.4,0.5,0), Vector3.new((math.pi+0.2)+(-animangle/26),0,-0.18))
1658
end
1659
end
1660
elseif hitz2.CanCollide == true then
1661
if animatebg.Parent ~= nil then
1662
animatebg.Parent = Torsoz
1663
animatebg.maxTorque = Vector3.new(1/0,10000,1/0)
1664
local lokvec = Torsoz.CFrame.lookVector*100
1665
animatebg.cframe = CFrame.new(NV, Vector3.new(lokvec.x,0,lokvec.z))
1666
animatebg.Parent = nil
1667
end
1668
end
1669
end
1670
 
1671
if GravAction == "Idle" and animatebg.Parent ~= nil then
1672
animatebg.Parent = nil
1673
end
1674
 
1675
if math.abs(tickoffset - tick()) > 0.05 then
1676
tickoffset = tick()
1677
local flowcolor = HSV(hue, 0.7,1)
1678
recyclecount = (recyclecount % #fadetab) + 1
1679
if flow.Value > 25 then
1680
local lapos = (LA.CFrame * CFrame.new(0,-1,0)).p
1681
local rapos = (RA.CFrame * CFrame.new(0,-1,0)).p
1682
local p = fadetab[recyclecount]
1683
p[1].Parent = m
1684
p[1].CFrame = CFrame.new((lapos+prevlapos)/2, lapos)
1685
p[2].Scale = Vector3.new(0.5,0.5,(lapos-prevlapos).magnitude*2)
1686
p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
1687
p[1].Transparency = math.abs((flow.Value/120) - 0.8)
1688
p[1].Transparency = p[1].Transparency + (1/#fadetab)
1689
local p = fadetab2[recyclecount]
1690
p[1].Parent = m
1691
p[1].CFrame = CFrame.new((rapos+prevrapos)/2, rapos)
1692
p[2].Scale = Vector3.new(0.5,0.5,(rapos-prevrapos).magnitude*2)
1693
p[2].VertexColor = Vector3.new(flowcolor.r,flowcolor.g,flowcolor.b)
1694
p[1].Transparency = math.abs((flow.Value/120) - 0.8)
1695
p[1].Transparency = p[1].Transparency + (1/#fadetab)
1696
end
1697
 
1698
for i, v in pairs(fadetab) do
1699
if v[1].Transparency < 0.9 then
1700
v[1].Transparency = v[1].Transparency + (1/#fadetab)
1701
fadetab2[i][1].Transparency = fadetab2[i][1].Transparency + (1/#fadetab)
1702
elseif v[1].Transparency ~= 1 then
1703
v[1].Transparency = 1
1704
v[1].Position = Vector3.new(50000,0,0)
1705
fadetab2[i][1].Transparency = 1
1706
fadetab2[i][1].Position = Vector3.new(50000,0,0)
1707
end
1708
end
1709
 
1710
prevrapos = (RA.CFrame * CFrame.new(0,-1,0)).p
1711
prevlapos = (LA.CFrame * CFrame.new(0,-1,0)).p
1712
end
1713
 
1714
if flow.Value > 140 then
1715
if char.Parent ~= nil then
1716
char:remove()
1717
end
1718
end
1719
 
1720
if flowcooldown > 0 then
1721
flowcooldown = flowcooldown - 1
1722
end
1723
if HWRCooldown > 0 then
1724
HWRCooldown = HWRCooldown - 1
1725
end
1726
if VWRCooldown > 0 then
1727
if hitz ~= nil and VWRCooldown > 0 then
1728
VWRCooldown = VWRCooldown - 1
1729
end
1730
end
1731
if SlideCooldown > 0 then
1732
SlideCooldown = SlideCooldown - 1
1733
end
1734
 
1735
if Action == "HWallRunning" or Action == "VWallRunning" then
1736
flow.Value = flow.Value + 0.24
1737
if flow.Value > 100 then
1738
flow.Value = 100
1739
end
1740
flowcooldown = 40
1741
elseif Action == "Diving" then
1742
flowcooldown = 30
1743
elseif Action == "Sliding" then
1744
flowcooldown = 15
1745
elseif Action == "Standing" or Action == "Sitting" then
1746
if flow.Value > 0 and flowcooldown <= 0 then
1747
flow.Value = flow.Value - 0.37
1748
if flow.Value < 0 then
1749
flow.Value = 0
1750
end
1751
end
1752
end
1753
 
1754
cam.FieldOfView = FOV
1755
prevanimbgcount = animatebgcount
1756
sprint = defsprint + ((flow.Value/100)*2.4)
1757
PrevGravAction = GravAction
1758
Calculate()
1759
end)