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