Advertisement
scriptaboii

test

May 28th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.59 KB | None | 0 0
  1. Tool = script.Parent
  2. Handle = Tool:WaitForChild("Handle")
  3.  
  4. Players = game:GetService("Players")
  5. Debris = game:GetService("Debris")
  6.  
  7. DisplayModel = Tool:FindFirstChild("DisplayModel")
  8. if DisplayModel then
  9. DisplayModel:Destroy()
  10. end
  11.  
  12. Assets = require(Tool:WaitForChild("Assets"))
  13. Data = Assets.Data
  14.  
  15. BaseUrl = Assets.BaseUrl
  16.  
  17. BasePart = Instance.new("Part")
  18. BasePart.Material = Enum.Material.Plastic
  19. BasePart.Shape = Enum.PartType.Block
  20. BasePart.TopSurface = Enum.SurfaceType.Smooth
  21. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  22. BasePart.FormFactor = Enum.FormFactor.Custom
  23. BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
  24. BasePart.Anchored = false
  25. BasePart.CanCollide = true
  26. BasePart.Locked = true
  27.  
  28. Animations = {
  29. Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil}
  30. }
  31.  
  32. Sounds = {
  33. Honk = Handle:WaitForChild("Honk"),
  34. Engine = Handle:WaitForChild("Running")
  35. }
  36.  
  37. Controls = {
  38. Forward = {Key = "w", ByteKey = 17, Mode = false},
  39. Backward = {Key = "s", ByteKey = 18, Mode = false},
  40. Left = {Key = "a", ByteKey = 20, Mode = false},
  41. Right = {Key = "d", ByteKey = 19, Mode = false}
  42. }
  43.  
  44. Rate = (1 / 60)
  45.  
  46. Gravity = 196.20
  47.  
  48. PoseOffset = CFrame.new(0, 0.85, -1) * CFrame.Angles(0, 0, 0) --The offset your character is from the center of the vehicle.
  49.  
  50. SpeedBoost = {
  51. Allowed = false,
  52. Active = false,
  53. Enabled = true,
  54. Duration = 10,
  55. ReloadTime = 30
  56. }
  57.  
  58. Special = {
  59. Allowed = false,
  60. Enabled = true,
  61. Active = false,
  62. Duration = 0,
  63. ReloadTime = 60
  64. }
  65.  
  66. Speed = {
  67. Acceleration = {
  68. Normal = 35,
  69. Boost = 35
  70. },
  71. Deceleration = {
  72. Normal = 30,
  73. Boost = 30
  74. },
  75. MovementSpeed = {
  76. Normal = {Min = 20, Max = 70},
  77. Boost = {Min = 20, Max = 70}
  78. },
  79. TurnSpeed = {
  80. Speed = {Min = 7.5, Max = 7.5},
  81. TurnAlpha = 0.30,
  82. AlphaDampening = 0.2
  83. },
  84. }
  85.  
  86. MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
  87. Movement = Speed.MovementSpeed.Normal,
  88. Turn = Speed.TurnSpeed.Speed,
  89. Acceleration = Speed.Acceleration.Normal,
  90. Deceleration = Speed.Deceleration.Normal
  91. }
  92.  
  93. CurrentSpeed = { --The speed which the vehicle is moving and turning at.
  94. Movement = 0,
  95. Turn = 0
  96. }
  97.  
  98. Honk = {
  99. Honking = false,
  100. LastHonk = 0,
  101. ReloadTime = 1
  102. }
  103.  
  104. Jump = {
  105. Jumping = false,
  106. LastJump = 0,
  107. ReloadTime = 1.9,
  108. JumpForce = 30
  109. }
  110.  
  111. TransparentParts = {}
  112.  
  113. ToolEquipped = false
  114.  
  115. ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  116. ServerControl.Name = "ServerControl"
  117. ServerControl.Parent = Tool
  118.  
  119. ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  120. ClientControl.Name = "ClientControl"
  121. ClientControl.Parent = Tool
  122.  
  123. Tool.Enabled = true
  124.  
  125. function SetTransparency(PrimaryParent, Transparency)
  126. local Parts = {}
  127. local function SetParentTransparency(Parent)
  128. for i, v in pairs(Parent:GetChildren()) do
  129. if v ~= Tool then
  130. if v.Name ~= "HumanoidRootPart" then
  131. local ItemTransparent = false
  132. for ii, vv in pairs(TransparentParts) do
  133. if vv and vv.Part and vv.Part == v then
  134. ItemTransparent = true
  135. end
  136. end
  137. if not ItemTransparent then
  138. pcall(function()
  139. table.insert(Parts, {Part = v, Transparency = v.Transparency})
  140. v.Transparency = Transparency
  141. end)
  142. end
  143. end
  144. SetParentTransparency(v, Transparency)
  145. end
  146. end
  147. end
  148. SetParentTransparency(PrimaryParent)
  149. return Parts
  150. end
  151.  
  152. function CheckTableForString(Table, String)
  153. for i, v in pairs(Table) do
  154. if string.find(string.lower(String), string.lower(v)) then
  155. return true
  156. end
  157. end
  158. return false
  159. end
  160.  
  161. function CheckIntangible(Hit)
  162. local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
  163. if Hit and Hit.Parent then
  164. if CheckTableForString(ProjectileNames, Hit.Name) or Hit.Parent:FindFirstChild("Humanoid") then
  165. return true
  166. end
  167. end
  168. return false
  169. end
  170.  
  171. function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
  172. local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
  173. local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
  174. if RayHit and CheckIntangible(RayHit) then
  175. if DelayIfHit then
  176. wait()
  177. end
  178. RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
  179. end
  180. return RayHit, RayPos, RayNormal
  181. end
  182.  
  183. function GetAllConnectedParts(Object)
  184. local Parts = {}
  185. local function GetConnectedParts(Object)
  186. for i, v in pairs(Object:GetConnectedParts()) do
  187. local Ignore = false
  188. for ii, vv in pairs(Parts) do
  189. if v == vv then
  190. Ignore = true
  191. end
  192. end
  193. if not Ignore then
  194. table.insert(Parts, v)
  195. GetConnectedParts(v)
  196. end
  197. end
  198. end
  199. GetConnectedParts(Object)
  200. return Parts
  201. end
  202.  
  203. function EnableFirstPersonView()
  204. if not CheckIfAlive() or not ToolEquipped then
  205. return
  206. end
  207. local Limbs = {}
  208.  
  209. if Humanoid then
  210. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  211. Limbs = {"Left Arm", "Right Arm"}
  212. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  213. Limbs = {"LeftLowerArm", "LeftUpperArm", "LeftHand", "RightLowerArm", "RightUpperArm", "RightHand"}
  214. end
  215. end
  216. for i, v in pairs(Limbs) do
  217. local Limb = Character:FindFirstChild(v)
  218. if Limb:IsA("BasePart") then
  219. Spawn(function()
  220. InvokeClient("SetLocalTransparencyModifier", {Object = Limb, Transparency = 0, AutoUpdate = false})
  221. end)
  222. end
  223. end
  224. end
  225.  
  226. function GetLookVectorAngle(Direction)
  227. local Angle = math.acos(Direction:Dot(Vector3.new(1, 0, 0)))
  228. local Modifier = math.acos(Direction:Dot(Vector3.new(0, 0, -1)))
  229. return (Angle * (Modifier > (math.pi / 2) and -1 or 1))
  230. end
  231.  
  232. function GetCFrameAngle(CFrame)
  233. local Vector1 = CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Top))
  234. local Vector2 = Vector3.new(0, 1, 0)
  235. local Angle = math.acos(Vector1:Dot(Vector2))
  236. return Angle
  237. end
  238.  
  239. function ThrustUpdater()
  240.  
  241. for i, v in pairs(CurrentSpeed) do
  242. CurrentSpeed[i] = 0
  243. end
  244. for i, v in pairs(Controls) do
  245. Controls[i].Mode = false
  246. end
  247.  
  248. while ToolEquipped and Body and Body.Parent and CheckIfAlive() and RotationForce and RotationForce.Parent and ThrustForce and ThrustForce.Parent and TurnGyro and TurnGyro.Parent do
  249.  
  250. RotationForce.angularvelocity = Vector3.new(0, CurrentSpeed.Turn, 0)
  251. if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
  252. CurrentSpeed.Turn = (CurrentSpeed.Turn - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
  253. else
  254. CurrentSpeed.Turn = 0
  255. end
  256.  
  257. if not Controls.Forward.Mode or Controls.Backward.Mode then --Slow down if not controlling.
  258. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.99)
  259. end
  260.  
  261. local MySpeed = Vector3.new(Body.Velocity.X, 0, Body.Velocity.Z).magnitude
  262. local VelocityDifference = math.abs((MySpeed - (ThrustForce.velocity.magnitude)))
  263. if MySpeed > 3 and ThrustForce.velocity.magnitude > 3 and VelocityDifference > (0.7 * ThrustForce.velocity.magnitude) then
  264. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.9)
  265. end
  266.  
  267. if Controls.Forward.Mode then --Handle acceleration
  268. CurrentSpeed.Movement = math.min(MaxSpeed.Movement.Max, (CurrentSpeed.Movement + (MaxSpeed.Acceleration * Rate)))
  269. end
  270. if Controls.Backward.Mode then --Handle deceleration, if speed is more than 0, decrease quicker.
  271. CurrentSpeed.Movement = math.max(-MaxSpeed.Movement.Min, (CurrentSpeed.Movement - (MaxSpeed.Deceleration * ((CurrentSpeed.Movement > 0 and 2.8) or 1) * Rate)))
  272. end
  273.  
  274. if (Controls.Forward.Mode or Controls.Backward.Mode) or CurrentSpeed.Movement >= (MaxSpeed.Movement.Max * 0.35) then
  275. if Controls.Left.Mode then --Handle left turn speed
  276. CurrentSpeed.Turn = math.min(Speed.TurnSpeed.Speed.Max, (CurrentSpeed.Turn + (Speed.TurnSpeed.TurnAlpha)))
  277. end
  278. if Controls.Right.Mode then --Handle right turn speed
  279. CurrentSpeed.Turn = math.max(-Speed.TurnSpeed.Speed.Min, (CurrentSpeed.Turn - (Speed.TurnSpeed.TurnAlpha)))
  280. end
  281. end
  282.  
  283. local Direction = Torso.CFrame.lookVector
  284. Direction = Vector3.new(Direction.x, 0, Direction.z).unit
  285.  
  286. local Velocity = (Direction * CurrentSpeed.Movement) --The thrust force which you move.
  287. ThrustForce.velocity = Vector3.new(Velocity.X, ThrustForce.velocity.Y, Velocity.Z)
  288.  
  289. local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 4) --Amount your character leans over.
  290. local XZAngle = math.atan2(Torso.CFrame.lookVector.z, 0, Torso.CFrame.lookVector.x) --Handle rotation
  291. --TurnGyro.cframe = CFrame.Angles((LeanAmount * Direction.X), 0, (LeanAmount * Direction.Z))
  292.  
  293. local RayPositions = {
  294. (Torso.CFrame * CFrame.new(0, 0, 0)),
  295. (Torso.CFrame * CFrame.new(0, 0, -((Body.Size.Z / 2) * 1))),
  296. (Torso.CFrame * CFrame.new(0, 0, ((Body.Size.Z / 2) * 1))),
  297. }
  298. local HighestPoint = {RayHit = nil, RayPos = nil, RayNormal = nil}
  299. for i, v in pairs(RayPositions) do
  300. local RayHit, RayPos, RayNormal = CastRay(v.p, Vector3.new(0, -1, 0), (Body.Size.Y * 2), {Character}, false)
  301. if RayHit and (not HighestPoint.RayPos or RayPos.Y > HighestPoint.RayPos.Y) then
  302. HighestPoint = {RayHit = RayHit, RayPos = RayPos, RayNormal = RayNormal}
  303. end
  304. end
  305. local AngleX, AngleY, AngleZ = Body.CFrame:toEulerAnglesXYZ()
  306. local Direction = ((HighestPoint.RayHit and (CFrame.new(HighestPoint.RayPos, (CFrame.new(HighestPoint.RayPos) + HighestPoint.RayNormal * 2).p) * CFrame.Angles((math.pi / 2), AngleY, math.pi))) or nil)
  307. TurnGyro.cframe = (((HighestPoint.RayHit and Direction and GetCFrameAngle(Direction) < (math.pi / 1.25)) and Direction) or CFrame.new(0, 0, 0))
  308.  
  309. --Wheel animation
  310. local DesiredAngle = (999999999 * (-CurrentSpeed.Movement / math.abs(CurrentSpeed.Movement)))
  311. local MaxVelocity = (CurrentSpeed.Movement / 250)
  312. for i, v in pairs({FrontLeftMotor, FrontRightMotor, BackLeftMotor, BackRightMotor}) do
  313. if v and v.Parent then
  314. v.DesiredAngle = DesiredAngle
  315. v.MaxVelocity = MaxVelocity
  316. end
  317. end
  318.  
  319. --Smoke exhaust from vehicle running.
  320. for i, v in pairs(ExhaustSmoke) do
  321. if v and v.Parent then
  322. v.Opacity = ((math.min(math.abs(CurrentSpeed.Movement), 10) / 10) * 0.5)
  323. end
  324. end
  325.  
  326. --Engine running sound which pitch changes while in motion.
  327. Sounds.Engine.Pitch = (0.75 + (math.abs(CurrentSpeed.Movement / MaxSpeed.Movement.Max) * 1))
  328.  
  329. wait(Rate)
  330.  
  331. end
  332. end
  333.  
  334. function SpawnVehicle()
  335.  
  336. Handle.Transparency = 1
  337.  
  338. Spawn(function()
  339. InvokeClient("PlaySound", Sounds.Engine)
  340. InvokeClient("PlayAnimation", Animations.Hold)
  341. end)
  342.  
  343. Humanoid.AutoRotate = false
  344. Humanoid.PlatformStand = true
  345. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  346.  
  347. local VehicleData = Assets.CreateVehicle()
  348. Body = VehicleData.Vehicle
  349. local ParticleTable = VehicleData.Tables
  350.  
  351. FrontLeftMotor = Body.FrontLeftMotor
  352. FrontRightMotor = Body.FrontRightMotor
  353. BackLeftMotor = Body.BackLeftMotor
  354. BackRightMotor = Body.BackRightMotor
  355.  
  356. ExhaustSmoke = ParticleTable.ExhaustSmoke
  357. Lights = ParticleTable.Lights
  358. Sparkles = ParticleTable.Sparkles
  359.  
  360. if SpeedBoost.Active then
  361. for i, v in pairs(Sparkles) do
  362. if v and v.Parent then
  363. v.Enabled = true
  364. end
  365. end
  366. end
  367.  
  368. local TorsoWeld = Instance.new("Weld")
  369. TorsoWeld.C0 = PoseOffset
  370. TorsoWeld.Part0 = Torso
  371. TorsoWeld.Part1 = Body
  372. TorsoWeld.Parent = Body
  373.  
  374. Body.CanCollide = true
  375.  
  376. local BaseTransparency = 1
  377. TransparentParts = SetTransparency(Character, BaseTransparency)
  378. ItemAdded = Character.ChildAdded:connect(function(Child)
  379. for i, v in pairs(SetTransparency(Child, BaseTransparency)) do
  380. table.insert(TransparentParts, v)
  381. end
  382. end)
  383. ItemRemoved = Character.ChildRemoved:connect(function(Child)
  384. for i, v in pairs(Child:GetChildren()) do
  385. for ii, vv in pairs(TransparentParts) do
  386. if vv.Part == v then
  387. vv.Part.Transparency = vv.Transparency
  388. table.remove(TransparentParts, ii)
  389. end
  390. end
  391. end
  392. end)
  393.  
  394. RotationForce = Instance.new("BodyAngularVelocity")
  395. RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
  396. RotationForce.angularvelocity = Vector3.new(0, 0, 0)
  397. RotationForce.Parent = Torso
  398.  
  399. ThrustForce = Instance.new("BodyVelocity")
  400. ThrustForce.maxForce = Vector3.new(math.huge, 0, math.huge)
  401. ThrustForce.velocity = Vector3.new(0, 0, 0)
  402. ThrustForce.P = 100
  403. ThrustForce.Parent = Torso
  404.  
  405. TurnGyro = Instance.new("BodyGyro")
  406. TurnGyro.maxTorque = Vector3.new(math.huge, 0, math.huge)
  407. TurnGyro.P = 300
  408. TurnGyro.D = 100
  409. TurnGyro.Parent = Torso
  410.  
  411. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2.5), {Character}, false)
  412. if RayHit then
  413. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  414. end
  415.  
  416. Body.CFrame = Torso.CFrame
  417. Body.Parent = Tool
  418.  
  419. Spawn(ThrustUpdater)
  420.  
  421. end
  422.  
  423. function FreezePlayer()
  424. if CheckIfAlive() then
  425. local FreezePart = BasePart:Clone()
  426. FreezePart.Name = "FreezePart"
  427. FreezePart.Transparency = 1
  428. FreezePart.Anchored = true
  429. FreezePart.CanCollide = false
  430. local FreezeWeld = Instance.new("Weld")
  431. FreezeWeld.Part0 = Torso
  432. FreezeWeld.Part1 = FreezePart
  433. FreezeWeld.Parent = FreezePart
  434. Debris:AddItem(FreezePart, 0.125)
  435. FreezePart.Parent = Character
  436. Torso.Velocity = Vector3.new(0, -25, 0)
  437. Torso.RotVelocity = Vector3.new(0, 0, 0)
  438. end
  439. end
  440.  
  441. function CleanUp()
  442. Handle.Velocity = Vector3.new(0, 0, 0)
  443. Handle.RotVelocity = Vector3.new(0, 0, 0)
  444. for i, v in pairs(TransparentParts) do
  445. if v and v.Part and v.Part.Parent then
  446. v.Part.Transparency = v.Transparency
  447. end
  448. end
  449. TransparentParts = {}
  450. for i, v in pairs({ItemAdded, ItemRemoved}) do
  451. if v then
  452. v:disconnect()
  453. end
  454. end
  455. for i, v in pairs({Body, RotationForce, ThrustForce, TurnGyro}) do
  456. if v and v.Parent then
  457. v:Destroy()
  458. end
  459. end
  460. for i, v in pairs(Tool:GetChildren()) do
  461. if v:IsA("BasePart") and v ~= Handle then
  462. v:Destroy()
  463. end
  464. end
  465. end
  466.  
  467. function CheckIfAlive()
  468. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
  469. end
  470.  
  471. function Equipped(Mouse)
  472. Character = Tool.Parent
  473. Player = Players:GetPlayerFromCharacter(Character)
  474. Humanoid = Character:FindFirstChild("Humanoid")
  475. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  476. if not CheckIfAlive() then
  477. return
  478. end
  479. Spawn(CleanUp)
  480. --Spawn(EnableFirstPersonView)
  481. Spawn(SpawnVehicle)
  482.  
  483. ToolEquipped = true
  484. end
  485.  
  486. function Unequipped()
  487. Spawn(CleanUp)
  488. Spawn(FreezePlayer)
  489. for i, v in pairs(Sounds) do
  490. v:Stop()
  491. Spawn(function()
  492. InvokeClient("StopSound", v)
  493. end)
  494. end
  495. if CheckIfAlive() then
  496. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  497. Humanoid.AutoRotate = true
  498. Humanoid.PlatformStand = false
  499. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character}, false)
  500. if RayHit then
  501. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  502. end
  503. end
  504. Handle.Transparency = 0
  505. ToolEquipped = false
  506. end
  507.  
  508. function OnServerInvoke(player, mode, value)
  509. if player == Player and ToolEquipped and value and CheckIfAlive() then
  510. if mode == "KeyPress" then
  511. local Down = value.Down
  512. local Key = value.Key
  513. local ByteKey = string.byte(Key)
  514. for i, v in pairs(Controls) do
  515. if Key == v.Key or ByteKey == v.ByteKey then
  516. Controls[i].Mode = Down
  517. end
  518. end
  519. if Key == " " and Down then --Jump controller
  520. if math.abs(tick() - Jump.LastJump) > Jump.ReloadTime and not Jump.Jumping and ThrustForce and ThrustForce.Parent then
  521. Jump.Jumping = true
  522. local Parts = GetAllConnectedParts(Body)
  523. local Mass = 0
  524. for i, v in pairs(Parts) do
  525. Mass = (Mass + v:GetMass())
  526. end
  527. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, ((Mass * Gravity) * 100), ThrustForce.maxForce.Z)
  528. ThrustForce.velocity = (Vector3.new(0, 1, 0) * Jump.JumpForce) + Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  529. wait(0.1)
  530. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, 0, ThrustForce.maxForce.Z)
  531. ThrustForce.velocity = Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  532. Jump.LastJump = tick()
  533. Jump.Jumping = false
  534. end
  535. elseif Key == "x" and Down then --Toggle light(s) on/off.
  536. for i, v in pairs(Lights) do
  537. if v and v.Parent then
  538. v.Enabled = not v.Enabled
  539. end
  540. end
  541. elseif Key == "h" and Down then --Play honk sound.
  542. local Sound = Sounds.Honk
  543. if (tick() - Honk.LastHonk) >= (Sound.TimeLength + Honk.ReloadTime) and not Honk.Honking then
  544. Honk.Honking = true
  545. local TempSound = Sound:Clone()
  546. Debris:AddItem(TempSound, Sound.TimeLength)
  547. TempSound.Parent = Body
  548. TempSound:Play()
  549. Honk.LastHonk = tick()
  550. Honk.Honking = false
  551. end
  552. elseif Key == "q" and Down then --Activate special.
  553. if not Special.Allowed or not Special.Enabled or Special.Active then
  554. return
  555. end
  556. Special.Enabled = false
  557. Special.Active = true
  558. wait(Special.Duration)
  559. Special.Active = false
  560. wait(Special.ReloadTime)
  561. Special.Enabled = true
  562. elseif ByteKey == 48 and Down then --Activate speed boost.
  563. if not SpeedBoost.Allowed or not SpeedBoost.Enabled or SpeedBoost.Active then
  564. return
  565. end
  566. SpeedBoost.Enabled = false
  567. SpeedBoost.Active = true
  568. for i, v in pairs(Sparkles) do
  569. if v and v.Parent then
  570. v.Enabled = true
  571. end
  572. end
  573. MaxSpeed.Acceleration = Speed.Acceleration.Boost
  574. MaxSpeed.Deceleration = Speed.Deceleration.Boost
  575. MaxSpeed.Movement = Speed.MovementSpeed.Boost
  576. wait(SpeedBoost.Duration)
  577. MaxSpeed.Acceleration = Speed.Acceleration.Normal
  578. MaxSpeed.Deceleration = Speed.Deceleration.Normal
  579. MaxSpeed.Movement = Speed.MovementSpeed.Normal
  580. for i, v in pairs(Sparkles) do
  581. if v and v.Parent then
  582. v.Enabled = false
  583. end
  584. end
  585. SpeedBoost.Active = false
  586. wait(SpeedBoost.ReloadTime)
  587. SpeedBoost.Enabled = true
  588. end
  589. end
  590. end
  591. end
  592.  
  593. function InvokeClient(Mode, Value)
  594. local ClientReturn = nil
  595. pcall(function()
  596. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  597. end)
  598. return ClientReturn
  599. end
  600.  
  601. Spawn(CleanUp)
  602.  
  603. Tool.Changed:connect(function(Property)
  604. if Property == "Parent" and Tool.Parent then
  605. Handle.Transparency = (((not Tool.Parent:IsA("Backpack") and not Players:GetPlayerFromCharacter(Tool.Parent)) and 0) or 1)
  606. end
  607. end)
  608.  
  609. ServerControl.OnServerInvoke = OnServerInvoke
  610. Tool.Equipped:connect(Equipped)
  611. Tool.Unequipped:connect(Unequipped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement