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