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