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