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