Advertisement
scriptaboii

test

May 28th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.67 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)
  612.  
  613.  
  614. function sandbox(var,func)
  615. local env = getfenv(func)
  616. local newenv = setmetatable({},{
  617. __index = function(self,k)
  618. if k=="script" then
  619. return var
  620. else
  621. return env[k]
  622. end
  623. end,
  624. })
  625. setfenv(func,newenv)
  626. return func
  627. end
  628. cors = {}
  629. mas = Instance.new("Model",game:GetService("Lighting"))
  630. Tool0 = Instance.new("Tool")
  631. Animation1 = Instance.new("Animation")
  632. Part2 = Instance.new("Part")
  633. Sound3 = Instance.new("Sound")
  634. Sound4 = Instance.new("Sound")
  635. SpecialMesh5 = Instance.new("SpecialMesh")
  636. Script6 = Instance.new("Script")
  637. LocalScript7 = Instance.new("LocalScript")
  638. LocalScript8 = Instance.new("LocalScript")
  639. ModuleScript9 = Instance.new("ModuleScript")
  640. RemoteFunction10 = Instance.new("RemoteFunction")
  641. RemoteFunction11 = Instance.new("RemoteFunction")
  642. Tool0.Name = "Corolla"
  643. Tool0.Parent = mas
  644. Tool0.TextureId = "rbxassetid://488158554"
  645. Tool0.Grip = CFrame.new(-2.75, 2, -0.75, 1, 3.05180438e-05, -3.05171125e-05, -3.05171125e-05, 1, 3.05180438e-05, 3.05180438e-05, -3.05171125e-05, 1)
  646. Tool0.GripForward = Vector3.new(3.05171125e-05, -3.05180438e-05, -1)
  647. Tool0.GripPos = Vector3.new(-2.75, 2, -0.75)
  648. Tool0.GripRight = Vector3.new(1, -3.05171125e-05, 3.05180438e-05)
  649. Tool0.GripUp = Vector3.new(3.05180438e-05, 1, -3.05171125e-05)
  650. Animation1.Name = "Hold"
  651. Animation1.Parent = Tool0
  652. Animation1.AnimationId = "http://www.roblox.com/asset/?id=264034706"
  653. Part2.Name = "Handle"
  654. Part2.Parent = Tool0
  655. Part2.CFrame = CFrame.new(-235.249954, 3.00001192, 49, 1, 4.74034932e-05, -1.24238431e-06, -4.74034969e-05, 0.99999994, -2.08965503e-08, 1.24424696e-06, 2.09547579e-08, 0.99999994)
  656. Part2.Position = Vector3.new(-235.249954, 3.00001192, 49)
  657. Part2.Size = Vector3.new(0.5, 2, 4)
  658. Part2.BottomSurface = Enum.SurfaceType.Smooth
  659. Part2.TopSurface = Enum.SurfaceType.Smooth
  660. Part2.FormFactor = Enum.FormFactor.Custom
  661. Part2.formFactor = Enum.FormFactor.Custom
  662. Sound3.Name = "Running"
  663. Sound3.Parent = Part2
  664. Sound3.Looped = true
  665. Sound3.EmitterSize = 0
  666. Sound3.MinDistance = 0
  667. Sound3.Pitch = 0.82130032777786
  668. Sound3.PlaybackSpeed = 0.82130032777786
  669. Sound3.SoundId = "http://www.roblox.com/asset/?id=247976926"
  670. Sound4.Name = "Honk"
  671. Sound4.Parent = Part2
  672. Sound4.EmitterSize = 0
  673. Sound4.MinDistance = 0
  674. Sound4.Pitch = 1.1000000238419
  675. Sound4.PlaybackSpeed = 1.1000000238419
  676. Sound4.SoundId = "http://www.roblox.com/asset/?id=248933537"
  677. Sound4.Volume = 0.34999999403954
  678. SpecialMesh5.Parent = Part2
  679. SpecialMesh5.MeshId = "rbxassetid://488158450"
  680. SpecialMesh5.Scale = Vector3.new(0.0700000003, 0.0700000003, 0.0700000003)
  681. SpecialMesh5.TextureId = "rbxassetid://488158554"
  682. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  683. Script6.Parent = Tool0
  684. table.insert(cors,sandbox(Script6,function()
  685. --Made by Luckymaxer
  686. --Updated for R15 avatar by StarWars
  687.  
  688. Tool = script.Parent
  689. Handle = Tool:WaitForChild("Handle")
  690.  
  691. Players = game:GetService("Players")
  692. Debris = game:GetService("Debris")
  693.  
  694. DisplayModel = Tool:FindFirstChild("DisplayModel")
  695. if DisplayModel then
  696. DisplayModel:Destroy()
  697. end
  698.  
  699. Assets = require(Tool:WaitForChild("Assets"))
  700. Data = Assets.Data
  701.  
  702. BaseUrl = Assets.BaseUrl
  703.  
  704. BasePart = Instance.new("Part")
  705. BasePart.Material = Enum.Material.Plastic
  706. BasePart.Shape = Enum.PartType.Block
  707. BasePart.TopSurface = Enum.SurfaceType.Smooth
  708. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  709. BasePart.FormFactor = Enum.FormFactor.Custom
  710. BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
  711. BasePart.Anchored = false
  712. BasePart.CanCollide = true
  713. BasePart.Locked = true
  714.  
  715. Animations = {
  716. Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil}
  717. }
  718.  
  719. Sounds = {
  720. Honk = Handle:WaitForChild("Honk"),
  721. Engine = Handle:WaitForChild("Running")
  722. }
  723.  
  724. Controls = {
  725. Forward = {Key = "w", ByteKey = 17, Mode = false},
  726. Backward = {Key = "s", ByteKey = 18, Mode = false},
  727. Left = {Key = "a", ByteKey = 20, Mode = false},
  728. Right = {Key = "d", ByteKey = 19, Mode = false}
  729. }
  730.  
  731. Rate = (1 / 60)
  732.  
  733. Gravity = 196.20
  734.  
  735. PoseOffset = CFrame.new(0, 0.85, -1) * CFrame.Angles(0, 0, 0) --The offset your character is from the center of the vehicle.
  736.  
  737. SpeedBoost = {
  738. Allowed = false,
  739. Active = false,
  740. Enabled = true,
  741. Duration = 10,
  742. ReloadTime = 30
  743. }
  744.  
  745. Special = {
  746. Allowed = false,
  747. Enabled = true,
  748. Active = false,
  749. Duration = 0,
  750. ReloadTime = 60
  751. }
  752.  
  753. Speed = {
  754. Acceleration = {
  755. Normal = 35,
  756. Boost = 35
  757. },
  758. Deceleration = {
  759. Normal = 30,
  760. Boost = 30
  761. },
  762. MovementSpeed = {
  763. Normal = {Min = 20, Max = 70},
  764. Boost = {Min = 20, Max = 70}
  765. },
  766. TurnSpeed = {
  767. Speed = {Min = 7.5, Max = 7.5},
  768. TurnAlpha = 0.30,
  769. AlphaDampening = 0.2
  770. },
  771. }
  772.  
  773. MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
  774. Movement = Speed.MovementSpeed.Normal,
  775. Turn = Speed.TurnSpeed.Speed,
  776. Acceleration = Speed.Acceleration.Normal,
  777. Deceleration = Speed.Deceleration.Normal
  778. }
  779.  
  780. CurrentSpeed = { --The speed which the vehicle is moving and turning at.
  781. Movement = 0,
  782. Turn = 0
  783. }
  784.  
  785. Honk = {
  786. Honking = false,
  787. LastHonk = 0,
  788. ReloadTime = 1
  789. }
  790.  
  791. Jump = {
  792. Jumping = false,
  793. LastJump = 0,
  794. ReloadTime = 1.9,
  795. JumpForce = 30
  796. }
  797.  
  798. TransparentParts = {}
  799.  
  800. ToolEquipped = false
  801.  
  802. ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  803. ServerControl.Name = "ServerControl"
  804. ServerControl.Parent = Tool
  805.  
  806. ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  807. ClientControl.Name = "ClientControl"
  808. ClientControl.Parent = Tool
  809.  
  810. Tool.Enabled = true
  811.  
  812. function SetTransparency(PrimaryParent, Transparency)
  813. local Parts = {}
  814. local function SetParentTransparency(Parent)
  815. for i, v in pairs(Parent:GetChildren()) do
  816. if v ~= Tool then
  817. if v.Name ~= "HumanoidRootPart" then
  818. local ItemTransparent = false
  819. for ii, vv in pairs(TransparentParts) do
  820. if vv and vv.Part and vv.Part == v then
  821. ItemTransparent = true
  822. end
  823. end
  824. if not ItemTransparent then
  825. pcall(function()
  826. table.insert(Parts, {Part = v, Transparency = v.Transparency})
  827. v.Transparency = Transparency
  828. end)
  829. end
  830. end
  831. SetParentTransparency(v, Transparency)
  832. end
  833. end
  834. end
  835. SetParentTransparency(PrimaryParent)
  836. return Parts
  837. end
  838.  
  839. function CheckTableForString(Table, String)
  840. for i, v in pairs(Table) do
  841. if string.find(string.lower(String), string.lower(v)) then
  842. return true
  843. end
  844. end
  845. return false
  846. end
  847.  
  848. function CheckIntangible(Hit)
  849. local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
  850. if Hit and Hit.Parent then
  851. if CheckTableForString(ProjectileNames, Hit.Name) or Hit.Parent:FindFirstChild("Humanoid") then
  852. return true
  853. end
  854. end
  855. return false
  856. end
  857.  
  858. function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
  859. local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
  860. local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
  861. if RayHit and CheckIntangible(RayHit) then
  862. if DelayIfHit then
  863. wait()
  864. end
  865. RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
  866. end
  867. return RayHit, RayPos, RayNormal
  868. end
  869.  
  870. function GetAllConnectedParts(Object)
  871. local Parts = {}
  872. local function GetConnectedParts(Object)
  873. for i, v in pairs(Object:GetConnectedParts()) do
  874. local Ignore = false
  875. for ii, vv in pairs(Parts) do
  876. if v == vv then
  877. Ignore = true
  878. end
  879. end
  880. if not Ignore then
  881. table.insert(Parts, v)
  882. GetConnectedParts(v)
  883. end
  884. end
  885. end
  886. GetConnectedParts(Object)
  887. return Parts
  888. end
  889.  
  890. function EnableFirstPersonView()
  891. if not CheckIfAlive() or not ToolEquipped then
  892. return
  893. end
  894. local Limbs = {}
  895.  
  896. if Humanoid then
  897. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  898. Limbs = {"Left Arm", "Right Arm"}
  899. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  900. Limbs = {"LeftLowerArm", "LeftUpperArm", "LeftHand", "RightLowerArm", "RightUpperArm", "RightHand"}
  901. end
  902. end
  903. for i, v in pairs(Limbs) do
  904. local Limb = Character:FindFirstChild(v)
  905. if Limb:IsA("BasePart") then
  906. Spawn(function()
  907. InvokeClient("SetLocalTransparencyModifier", {Object = Limb, Transparency = 0, AutoUpdate = false})
  908. end)
  909. end
  910. end
  911. end
  912.  
  913. function GetLookVectorAngle(Direction)
  914. local Angle = math.acos(Direction:Dot(Vector3.new(1, 0, 0)))
  915. local Modifier = math.acos(Direction:Dot(Vector3.new(0, 0, -1)))
  916. return (Angle * (Modifier > (math.pi / 2) and -1 or 1))
  917. end
  918.  
  919. function GetCFrameAngle(CFrame)
  920. local Vector1 = CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Top))
  921. local Vector2 = Vector3.new(0, 1, 0)
  922. local Angle = math.acos(Vector1:Dot(Vector2))
  923. return Angle
  924. end
  925.  
  926. function ThrustUpdater()
  927.  
  928. for i, v in pairs(CurrentSpeed) do
  929. CurrentSpeed[i] = 0
  930. end
  931. for i, v in pairs(Controls) do
  932. Controls[i].Mode = false
  933. end
  934.  
  935. 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
  936.  
  937. RotationForce.angularvelocity = Vector3.new(0, CurrentSpeed.Turn, 0)
  938. if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
  939. CurrentSpeed.Turn = (CurrentSpeed.Turn - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
  940. else
  941. CurrentSpeed.Turn = 0
  942. end
  943.  
  944. if not Controls.Forward.Mode or Controls.Backward.Mode then --Slow down if not controlling.
  945. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.99)
  946. end
  947.  
  948. local MySpeed = Vector3.new(Body.Velocity.X, 0, Body.Velocity.Z).magnitude
  949. local VelocityDifference = math.abs((MySpeed - (ThrustForce.velocity.magnitude)))
  950. if MySpeed > 3 and ThrustForce.velocity.magnitude > 3 and VelocityDifference > (0.7 * ThrustForce.velocity.magnitude) then
  951. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.9)
  952. end
  953.  
  954. if Controls.Forward.Mode then --Handle acceleration
  955. CurrentSpeed.Movement = math.min(MaxSpeed.Movement.Max, (CurrentSpeed.Movement + (MaxSpeed.Acceleration * Rate)))
  956. end
  957. if Controls.Backward.Mode then --Handle deceleration, if speed is more than 0, decrease quicker.
  958. CurrentSpeed.Movement = math.max(-MaxSpeed.Movement.Min, (CurrentSpeed.Movement - (MaxSpeed.Deceleration * ((CurrentSpeed.Movement > 0 and 2.8) or 1) * Rate)))
  959. end
  960.  
  961. if (Controls.Forward.Mode or Controls.Backward.Mode) or CurrentSpeed.Movement >= (MaxSpeed.Movement.Max * 0.35) then
  962. if Controls.Left.Mode then --Handle left turn speed
  963. CurrentSpeed.Turn = math.min(Speed.TurnSpeed.Speed.Max, (CurrentSpeed.Turn + (Speed.TurnSpeed.TurnAlpha)))
  964. end
  965. if Controls.Right.Mode then --Handle right turn speed
  966. CurrentSpeed.Turn = math.max(-Speed.TurnSpeed.Speed.Min, (CurrentSpeed.Turn - (Speed.TurnSpeed.TurnAlpha)))
  967. end
  968. end
  969.  
  970. local Direction = Torso.CFrame.lookVector
  971. Direction = Vector3.new(Direction.x, 0, Direction.z).unit
  972.  
  973. local Velocity = (Direction * CurrentSpeed.Movement) --The thrust force which you move.
  974. ThrustForce.velocity = Vector3.new(Velocity.X, ThrustForce.velocity.Y, Velocity.Z)
  975.  
  976. local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 4) --Amount your character leans over.
  977. local XZAngle = math.atan2(Torso.CFrame.lookVector.z, 0, Torso.CFrame.lookVector.x) --Handle rotation
  978. --TurnGyro.cframe = CFrame.Angles((LeanAmount * Direction.X), 0, (LeanAmount * Direction.Z))
  979.  
  980. local RayPositions = {
  981. (Torso.CFrame * CFrame.new(0, 0, 0)),
  982. (Torso.CFrame * CFrame.new(0, 0, -((Body.Size.Z / 2) * 1))),
  983. (Torso.CFrame * CFrame.new(0, 0, ((Body.Size.Z / 2) * 1))),
  984. }
  985. local HighestPoint = {RayHit = nil, RayPos = nil, RayNormal = nil}
  986. for i, v in pairs(RayPositions) do
  987. local RayHit, RayPos, RayNormal = CastRay(v.p, Vector3.new(0, -1, 0), (Body.Size.Y * 2), {Character}, false)
  988. if RayHit and (not HighestPoint.RayPos or RayPos.Y > HighestPoint.RayPos.Y) then
  989. HighestPoint = {RayHit = RayHit, RayPos = RayPos, RayNormal = RayNormal}
  990. end
  991. end
  992. local AngleX, AngleY, AngleZ = Body.CFrame:toEulerAnglesXYZ()
  993. 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)
  994. TurnGyro.cframe = (((HighestPoint.RayHit and Direction and GetCFrameAngle(Direction) < (math.pi / 1.25)) and Direction) or CFrame.new(0, 0, 0))
  995.  
  996. --Wheel animation
  997. local DesiredAngle = (999999999 * (-CurrentSpeed.Movement / math.abs(CurrentSpeed.Movement)))
  998. local MaxVelocity = (CurrentSpeed.Movement / 250)
  999. for i, v in pairs({FrontLeftMotor, FrontRightMotor, BackLeftMotor, BackRightMotor}) do
  1000. if v and v.Parent then
  1001. v.DesiredAngle = DesiredAngle
  1002. v.MaxVelocity = MaxVelocity
  1003. end
  1004. end
  1005.  
  1006. --Smoke exhaust from vehicle running.
  1007. for i, v in pairs(ExhaustSmoke) do
  1008. if v and v.Parent then
  1009. v.Opacity = ((math.min(math.abs(CurrentSpeed.Movement), 10) / 10) * 0.5)
  1010. end
  1011. end
  1012.  
  1013. --Engine running sound which pitch changes while in motion.
  1014. Sounds.Engine.Pitch = (0.75 + (math.abs(CurrentSpeed.Movement / MaxSpeed.Movement.Max) * 1))
  1015.  
  1016. wait(Rate)
  1017.  
  1018. end
  1019. end
  1020.  
  1021. function SpawnVehicle()
  1022.  
  1023. Handle.Transparency = 1
  1024.  
  1025. Spawn(function()
  1026. InvokeClient("PlaySound", Sounds.Engine)
  1027. InvokeClient("PlayAnimation", Animations.Hold)
  1028. end)
  1029.  
  1030. Humanoid.AutoRotate = false
  1031. Humanoid.PlatformStand = true
  1032. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  1033.  
  1034. local VehicleData = Assets.CreateVehicle()
  1035. Body = VehicleData.Vehicle
  1036. local ParticleTable = VehicleData.Tables
  1037.  
  1038. FrontLeftMotor = Body.FrontLeftMotor
  1039. FrontRightMotor = Body.FrontRightMotor
  1040. BackLeftMotor = Body.BackLeftMotor
  1041. BackRightMotor = Body.BackRightMotor
  1042.  
  1043. ExhaustSmoke = ParticleTable.ExhaustSmoke
  1044. Lights = ParticleTable.Lights
  1045. Sparkles = ParticleTable.Sparkles
  1046.  
  1047. if SpeedBoost.Active then
  1048. for i, v in pairs(Sparkles) do
  1049. if v and v.Parent then
  1050. v.Enabled = true
  1051. end
  1052. end
  1053. end
  1054.  
  1055. local TorsoWeld = Instance.new("Weld")
  1056. TorsoWeld.C0 = PoseOffset
  1057. TorsoWeld.Part0 = Torso
  1058. TorsoWeld.Part1 = Body
  1059. TorsoWeld.Parent = Body
  1060.  
  1061. Body.CanCollide = true
  1062.  
  1063. local BaseTransparency = 1
  1064. TransparentParts = SetTransparency(Character, BaseTransparency)
  1065. ItemAdded = Character.ChildAdded:connect(function(Child)
  1066. for i, v in pairs(SetTransparency(Child, BaseTransparency)) do
  1067. table.insert(TransparentParts, v)
  1068. end
  1069. end)
  1070. ItemRemoved = Character.ChildRemoved:connect(function(Child)
  1071. for i, v in pairs(Child:GetChildren()) do
  1072. for ii, vv in pairs(TransparentParts) do
  1073. if vv.Part == v then
  1074. vv.Part.Transparency = vv.Transparency
  1075. table.remove(TransparentParts, ii)
  1076. end
  1077. end
  1078. end
  1079. end)
  1080.  
  1081. RotationForce = Instance.new("BodyAngularVelocity")
  1082. RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
  1083. RotationForce.angularvelocity = Vector3.new(0, 0, 0)
  1084. RotationForce.Parent = Torso
  1085.  
  1086. ThrustForce = Instance.new("BodyVelocity")
  1087. ThrustForce.maxForce = Vector3.new(math.huge, 0, math.huge)
  1088. ThrustForce.velocity = Vector3.new(0, 0, 0)
  1089. ThrustForce.P = 100
  1090. ThrustForce.Parent = Torso
  1091.  
  1092. TurnGyro = Instance.new("BodyGyro")
  1093. TurnGyro.maxTorque = Vector3.new(math.huge, 0, math.huge)
  1094. TurnGyro.P = 300
  1095. TurnGyro.D = 100
  1096. TurnGyro.Parent = Torso
  1097.  
  1098. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2.5), {Character}, false)
  1099. if RayHit then
  1100. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  1101. end
  1102.  
  1103. Body.CFrame = Torso.CFrame
  1104. Body.Parent = Tool
  1105.  
  1106. Spawn(ThrustUpdater)
  1107.  
  1108. end
  1109.  
  1110. function FreezePlayer()
  1111. if CheckIfAlive() then
  1112. local FreezePart = BasePart:Clone()
  1113. FreezePart.Name = "FreezePart"
  1114. FreezePart.Transparency = 1
  1115. FreezePart.Anchored = true
  1116. FreezePart.CanCollide = false
  1117. local FreezeWeld = Instance.new("Weld")
  1118. FreezeWeld.Part0 = Torso
  1119. FreezeWeld.Part1 = FreezePart
  1120. FreezeWeld.Parent = FreezePart
  1121. Debris:AddItem(FreezePart, 0.125)
  1122. FreezePart.Parent = Character
  1123. Torso.Velocity = Vector3.new(0, -25, 0)
  1124. Torso.RotVelocity = Vector3.new(0, 0, 0)
  1125. end
  1126. end
  1127.  
  1128. function CleanUp()
  1129. Handle.Velocity = Vector3.new(0, 0, 0)
  1130. Handle.RotVelocity = Vector3.new(0, 0, 0)
  1131. for i, v in pairs(TransparentParts) do
  1132. if v and v.Part and v.Part.Parent then
  1133. v.Part.Transparency = v.Transparency
  1134. end
  1135. end
  1136. TransparentParts = {}
  1137. for i, v in pairs({ItemAdded, ItemRemoved}) do
  1138. if v then
  1139. v:disconnect()
  1140. end
  1141. end
  1142. for i, v in pairs({Body, RotationForce, ThrustForce, TurnGyro}) do
  1143. if v and v.Parent then
  1144. v:Destroy()
  1145. end
  1146. end
  1147. for i, v in pairs(Tool:GetChildren()) do
  1148. if v:IsA("BasePart") and v ~= Handle then
  1149. v:Destroy()
  1150. end
  1151. end
  1152. end
  1153.  
  1154. function CheckIfAlive()
  1155. 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)
  1156. end
  1157.  
  1158. function Equipped(Mouse)
  1159. Character = Tool.Parent
  1160. Player = Players:GetPlayerFromCharacter(Character)
  1161. Humanoid = Character:FindFirstChild("Humanoid")
  1162. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  1163. if not CheckIfAlive() then
  1164. return
  1165. end
  1166. Spawn(CleanUp)
  1167. --Spawn(EnableFirstPersonView)
  1168. Spawn(SpawnVehicle)
  1169.  
  1170. ToolEquipped = true
  1171. end
  1172.  
  1173. function Unequipped()
  1174. Spawn(CleanUp)
  1175. Spawn(FreezePlayer)
  1176. for i, v in pairs(Sounds) do
  1177. v:Stop()
  1178. Spawn(function()
  1179. InvokeClient("StopSound", v)
  1180. end)
  1181. end
  1182. if CheckIfAlive() then
  1183. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  1184. Humanoid.AutoRotate = true
  1185. Humanoid.PlatformStand = false
  1186. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character}, false)
  1187. if RayHit then
  1188. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  1189. end
  1190. end
  1191. Handle.Transparency = 0
  1192. ToolEquipped = false
  1193. end
  1194.  
  1195. function OnServerInvoke(player, mode, value)
  1196. if player == Player and ToolEquipped and value and CheckIfAlive() then
  1197. if mode == "KeyPress" then
  1198. local Down = value.Down
  1199. local Key = value.Key
  1200. local ByteKey = string.byte(Key)
  1201. for i, v in pairs(Controls) do
  1202. if Key == v.Key or ByteKey == v.ByteKey then
  1203. Controls[i].Mode = Down
  1204. end
  1205. end
  1206. if Key == " " and Down then --Jump controller
  1207. if math.abs(tick() - Jump.LastJump) > Jump.ReloadTime and not Jump.Jumping and ThrustForce and ThrustForce.Parent then
  1208. Jump.Jumping = true
  1209. local Parts = GetAllConnectedParts(Body)
  1210. local Mass = 0
  1211. for i, v in pairs(Parts) do
  1212. Mass = (Mass + v:GetMass())
  1213. end
  1214. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, ((Mass * Gravity) * 100), ThrustForce.maxForce.Z)
  1215. ThrustForce.velocity = (Vector3.new(0, 1, 0) * Jump.JumpForce) + Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  1216. wait(0.1)
  1217. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, 0, ThrustForce.maxForce.Z)
  1218. ThrustForce.velocity = Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  1219. Jump.LastJump = tick()
  1220. Jump.Jumping = false
  1221. end
  1222. elseif Key == "x" and Down then --Toggle light(s) on/off.
  1223. for i, v in pairs(Lights) do
  1224. if v and v.Parent then
  1225. v.Enabled = not v.Enabled
  1226. end
  1227. end
  1228. elseif Key == "h" and Down then --Play honk sound.
  1229. local Sound = Sounds.Honk
  1230. if (tick() - Honk.LastHonk) >= (Sound.TimeLength + Honk.ReloadTime) and not Honk.Honking then
  1231. Honk.Honking = true
  1232. local TempSound = Sound:Clone()
  1233. Debris:AddItem(TempSound, Sound.TimeLength)
  1234. TempSound.Parent = Body
  1235. TempSound:Play()
  1236. Honk.LastHonk = tick()
  1237. Honk.Honking = false
  1238. end
  1239. elseif Key == "q" and Down then --Activate special.
  1240. if not Special.Allowed or not Special.Enabled or Special.Active then
  1241. return
  1242. end
  1243. Special.Enabled = false
  1244. Special.Active = true
  1245. wait(Special.Duration)
  1246. Special.Active = false
  1247. wait(Special.ReloadTime)
  1248. Special.Enabled = true
  1249. elseif ByteKey == 48 and Down then --Activate speed boost.
  1250. if not SpeedBoost.Allowed or not SpeedBoost.Enabled or SpeedBoost.Active then
  1251. return
  1252. end
  1253. SpeedBoost.Enabled = false
  1254. SpeedBoost.Active = true
  1255. for i, v in pairs(Sparkles) do
  1256. if v and v.Parent then
  1257. v.Enabled = true
  1258. end
  1259. end
  1260. MaxSpeed.Acceleration = Speed.Acceleration.Boost
  1261. MaxSpeed.Deceleration = Speed.Deceleration.Boost
  1262. MaxSpeed.Movement = Speed.MovementSpeed.Boost
  1263. wait(SpeedBoost.Duration)
  1264. MaxSpeed.Acceleration = Speed.Acceleration.Normal
  1265. MaxSpeed.Deceleration = Speed.Deceleration.Normal
  1266. MaxSpeed.Movement = Speed.MovementSpeed.Normal
  1267. for i, v in pairs(Sparkles) do
  1268. if v and v.Parent then
  1269. v.Enabled = false
  1270. end
  1271. end
  1272. SpeedBoost.Active = false
  1273. wait(SpeedBoost.ReloadTime)
  1274. SpeedBoost.Enabled = true
  1275. end
  1276. end
  1277. end
  1278. end
  1279.  
  1280. function InvokeClient(Mode, Value)
  1281. local ClientReturn = nil
  1282. pcall(function()
  1283. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  1284. end)
  1285. return ClientReturn
  1286. end
  1287.  
  1288. Spawn(CleanUp)
  1289.  
  1290. Tool.Changed:connect(function(Property)
  1291. if Property == "Parent" and Tool.Parent then
  1292. Handle.Transparency = (((not Tool.Parent:IsA("Backpack") and not Players:GetPlayerFromCharacter(Tool.Parent)) and 0) or 1)
  1293. end
  1294. end)
  1295.  
  1296. ServerControl.OnServerInvoke = OnServerInvoke
  1297. Tool.Equipped:connect(Equipped)
  1298. Tool.Unequipped:connect(Unequipped)
  1299. end))
  1300. LocalScript7.Name = "MouseIcon"
  1301. LocalScript7.Parent = Tool0
  1302. table.insert(cors,sandbox(LocalScript7,function()
  1303. --Made by Luckymaxer
  1304.  
  1305. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  1306. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  1307.  
  1308. Tool = script.Parent
  1309.  
  1310. Mouse = nil
  1311.  
  1312. function UpdateIcon()
  1313. if Mouse then
  1314. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  1315. end
  1316. end
  1317.  
  1318. function OnEquipped(ToolMouse)
  1319. Mouse = ToolMouse
  1320. UpdateIcon()
  1321. end
  1322.  
  1323. function OnChanged(Property)
  1324. if Property == "Enabled" then
  1325. UpdateIcon()
  1326. end
  1327. end
  1328.  
  1329. Tool.Equipped:connect(OnEquipped)
  1330. Tool.Changed:connect(OnChanged)
  1331. end))
  1332. LocalScript8.Parent = Tool0
  1333. table.insert(cors,sandbox(LocalScript8,function()
  1334. --Made by Luckymaxer
  1335.  
  1336. Tool = script.Parent
  1337. Handle = Tool:WaitForChild("Handle")
  1338.  
  1339. Players = game:GetService("Players")
  1340. RunService = game:GetService("RunService")
  1341.  
  1342. Camera = game:GetService("Workspace").CurrentCamera
  1343.  
  1344. Animations = {}
  1345. LocalObjects = {}
  1346.  
  1347. ServerControl = Tool:WaitForChild("ServerControl")
  1348. ClientControl = Tool:WaitForChild("ClientControl")
  1349.  
  1350. ToolEquipped = false
  1351.  
  1352. function SetAnimation(mode, value)
  1353. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  1354. for i, v in pairs(Animations) do
  1355. if v.Animation == value.Animation then
  1356. v.AnimationTrack:Stop()
  1357. table.remove(Animations, i)
  1358. end
  1359. end
  1360. local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
  1361. table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
  1362. AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
  1363. elseif mode == "StopAnimation" and value then
  1364. for i, v in pairs(Animations) do
  1365. if v.Animation == value.Animation then
  1366. v.AnimationTrack:Stop()
  1367. table.remove(Animations, i)
  1368. end
  1369. end
  1370. end
  1371. end
  1372.  
  1373. function DisableJump(Boolean)
  1374. if PreventJump then
  1375. PreventJump:disconnect()
  1376. end
  1377. if Boolean then
  1378. PreventJump = Humanoid.Changed:connect(function(Property)
  1379. if Property == "Jump" then
  1380. Humanoid.Jump = false
  1381. end
  1382. end)
  1383. end
  1384. end
  1385.  
  1386. function CheckIfAlive()
  1387. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
  1388. end
  1389.  
  1390. function Equipped(Mouse)
  1391. Character = Tool.Parent
  1392. Player = Players:GetPlayerFromCharacter(Character)
  1393. Humanoid = Character:FindFirstChild("Humanoid")
  1394. ToolEquipped = true
  1395. if not CheckIfAlive() then
  1396. return
  1397. end
  1398. PlayerMouse = Player:GetMouse()
  1399. Mouse.Button1Down:connect(function()
  1400. InvokeServer("MouseClick", {Down = true})
  1401. end)
  1402. Mouse.Button1Up:connect(function()
  1403. InvokeServer("MouseClick", {Down = false})
  1404. end)
  1405. Mouse.KeyDown:connect(function(Key)
  1406. InvokeServer("KeyPress", {Key = Key, Down = true})
  1407. end)
  1408. Mouse.KeyUp:connect(function(Key)
  1409. InvokeServer("KeyPress", {Key = Key, Down = false})
  1410. end)
  1411. Mouse.Move:connect(function()
  1412. InvokeServer("MouseMove", {Position = Mouse.Hit.p, Target = Mouse.Target})
  1413. end)
  1414. Humanoid:ChangeState(Enum.HumanoidStateType.None)
  1415. end
  1416.  
  1417. function Unequipped()
  1418. ToolEquipped = false
  1419. LocalObjects = {}
  1420. for i, v in pairs(Animations) do
  1421. if v and v.AnimationTrack then
  1422. v.AnimationTrack:Stop()
  1423. end
  1424. end
  1425. for i, v in pairs({PreventJump, ObjectLocalTransparencyModifier}) do
  1426. if v then
  1427. v:disconnect()
  1428. end
  1429. end
  1430. Humanoid:ChangeState(Enum.HumanoidStateType.Freefall) --Prevent the ability to fly by constantly equipping and unequipping the tool.
  1431. Animations = {}
  1432. end
  1433.  
  1434. function InvokeServer(mode, value)
  1435. pcall(function()
  1436. local ServerReturn = ServerControl:InvokeServer(mode, value)
  1437. return ServerReturn
  1438. end)
  1439. end
  1440.  
  1441. function OnClientInvoke(mode, value)
  1442. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  1443. SetAnimation("PlayAnimation", value)
  1444. elseif mode == "StopAnimation" and value then
  1445. SetAnimation("StopAnimation", value)
  1446. elseif mode == "PlaySound" and value then
  1447. value:Play()
  1448. elseif mode == "StopSound" and value then
  1449. value:Stop()
  1450. elseif mode == "MousePosition" then
  1451. return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
  1452. elseif mode == "DisableJump" then
  1453. DisableJump(value)
  1454. elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
  1455. pcall(function()
  1456. local ObjectFound = false
  1457. for i, v in pairs(LocalObjects) do
  1458. if v == value then
  1459. ObjectFound = true
  1460. end
  1461. end
  1462. if not ObjectFound then
  1463. table.insert(LocalObjects, value)
  1464. if ObjectLocalTransparencyModifier then
  1465. ObjectLocalTransparencyModifier:disconnect()
  1466. end
  1467. ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
  1468. for i, v in pairs(LocalObjects) do
  1469. if v.Object and v.Object.Parent then
  1470. local CurrentTransparency = v.Object.LocalTransparencyModifier
  1471. if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
  1472. v.Object.LocalTransparencyModifier = v.Transparency
  1473. end
  1474. else
  1475. table.remove(LocalObjects, i)
  1476. end
  1477. end
  1478. end)
  1479. end
  1480. end)
  1481. end
  1482. end
  1483.  
  1484. ClientControl.OnClientInvoke = OnClientInvoke
  1485. Tool.Equipped:connect(Equipped)
  1486. Tool.Unequipped:connect(Unequipped)
  1487. end))
  1488. ModuleScript9.Name = "Assets"
  1489. ModuleScript9.Parent = Tool0
  1490. table.insert(cors,sandbox(ModuleScript9,function()
  1491. --Made by Luckymaxer
  1492.  
  1493. BaseUrl = "http://www.roblox.com/asset/?id="
  1494.  
  1495. RbxUtility = LoadLibrary("RbxUtility")
  1496. Create = RbxUtility.Create
  1497.  
  1498. BasePart = Create("Part"){
  1499. Material = Enum.Material.Plastic,
  1500. Shape = Enum.PartType.Block,
  1501. TopSurface = Enum.SurfaceType.Smooth,
  1502. BottomSurface = Enum.SurfaceType.Smooth,
  1503. FormFactor = Enum.FormFactor.Custom,
  1504. Size = Vector3.new(0.2, 0.2, 0.2),
  1505. Anchored = false,
  1506. CanCollide = true,
  1507. Locked = true
  1508. }
  1509.  
  1510. MeshData = {
  1511. Meshes = {
  1512. Body = 488158450,
  1513. Wheel = 0,
  1514. },
  1515. TextureId = 488158554,
  1516. }
  1517.  
  1518. function CreateVehicle()
  1519.  
  1520. local ExhaustSmoke = {}
  1521. local Lights = {}
  1522. local Sparkles = {}
  1523.  
  1524. local Body = BasePart:Clone()
  1525. Body.Name = "Body"
  1526. Body.Size = Vector3.new(6.25, 3.9, 12)
  1527. local BodyMesh = Create("SpecialMesh"){
  1528. MeshType = Enum.MeshType.FileMesh,
  1529. MeshId = MeshData.Meshes.Body,
  1530. TextureId = MeshData.TextureId,
  1531. Scale = Vector3.new(0.07, 0.07, 0.07),
  1532. VertexColor = Vector3.new(1, 1, 1),
  1533. Offset = Vector3.new(0, 0.2, 0),
  1534. Parent = Body
  1535. }
  1536.  
  1537. local BaseWheel = BasePart:Clone()
  1538. BaseWheel.Size = Vector3.new(0.5, 1, 1)
  1539. BaseWheel.CanCollide = false
  1540. local WheelMesh = Create("SpecialMesh"){
  1541. MeshType = Enum.MeshType.FileMesh,
  1542. MeshId = MeshData.Meshes.Wheel,
  1543. TextureId = MeshData.TextureId,
  1544. Scale = Vector3.new(1.6, 1.6, 1.6),
  1545. VertexColor = Vector3.new(1, 1, 1),
  1546. Offset = Vector3.new(0, 0, 0),
  1547. Parent = BaseWheel,
  1548. }
  1549.  
  1550. local BaseFrontWheel = BaseWheel:Clone()
  1551. BaseFrontWheel.Name = "FrontWheel"
  1552.  
  1553. local BaseBackWheel = BaseWheel:Clone()
  1554. BaseBackWheel.Name = "BackWheel"
  1555.  
  1556. local BaseSmokePart = BasePart:Clone()
  1557. BaseSmokePart.Name = "SmokePart"
  1558. BaseSmokePart.Transparency = 1
  1559. BaseSmokePart.CanCollide = false
  1560. local BaseExhaustSmoke = Create("Smoke"){
  1561. Name = "ExhaustSmoke",
  1562. Size = 0.1,
  1563. RiseVelocity = 0.01,
  1564. Color = Color3.new((127 / 255), (127 / 255), (127 / 255)),
  1565. Enabled = true,
  1566. Parent = BaseSmokePart,
  1567. }
  1568.  
  1569. local BaseLightPart = BasePart:Clone()
  1570. BaseLightPart.Name = "LightPart"
  1571. BaseLightPart.Transparency = 1
  1572. BaseLightPart.CanCollide = false
  1573. local Light = Create("SpotLight"){
  1574. Name = "Light",
  1575. Brightness = 5,
  1576. Angle = 45,
  1577. Color = Color3.new(255 / 255, 252 / 255, 153 / 255),
  1578. Range = 30,
  1579. Shadows = false,
  1580. Enabled = false,
  1581. Parent = BaseLightPart,
  1582. }
  1583.  
  1584. local FrontLeftWheel = BaseFrontWheel:Clone()
  1585. FrontLeftWheel.Name = "FrontLeftWheel"
  1586. FrontLeftWheel.Parent = Body
  1587.  
  1588. local FrontLeftMotor = Create("Motor6D"){
  1589. Name = "FrontLeftMotor",
  1590. Part0 = Body,
  1591. Part1 = FrontLeftWheel,
  1592. C0 = CFrame.new(-2.25, -1.1, -3.25) * CFrame.Angles(0, (math.pi / 2), 0),
  1593. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, (math.pi / 2), 0),
  1594. Parent = Body
  1595. }
  1596.  
  1597. local FrontRightWheel = BaseFrontWheel:Clone()
  1598. FrontRightWheel.Name = "FrontRightWheel"
  1599. FrontRightWheel.Parent = Body
  1600.  
  1601. local FrontRightMotor = Create("Motor6D"){
  1602. Name = "FrontRightMotor",
  1603. Part0 = Body,
  1604. Part1 = FrontRightWheel,
  1605. C0 = CFrame.new(2.25, -1.1, -3.25) * CFrame.Angles(0, (math.pi / 2), 0),
  1606. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, -(math.pi / 2), 0),
  1607. Parent = Body
  1608. }
  1609.  
  1610. local BackLeftWheel = BaseBackWheel:Clone()
  1611. BackLeftWheel.Name = "BackLeftWheel"
  1612. BackLeftWheel.Parent = Body
  1613.  
  1614. local BackLeftMotor = Create("Motor6D"){
  1615. Name = "BackLeftMotor",
  1616. Part0 = Body,
  1617. Part1 = BackLeftWheel,
  1618. C0 = CFrame.new(-2.25, -1.1, 3.95) * CFrame.Angles(0, (math.pi / 2), 0),
  1619. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, (math.pi / 2), 0),
  1620. Parent = Body
  1621. }
  1622.  
  1623. local BackRightWheel = BackLeftWheel:Clone()
  1624. BackRightWheel.Name = "BackRightWheel"
  1625. BackRightWheel.Parent = Body
  1626.  
  1627. local BackRightMotor = Create("Motor6D"){
  1628. Name = "BackRightMotor",
  1629. Part0 = Body,
  1630. Part1 = BackRightWheel,
  1631. C0 = CFrame.new(2.25, -1.1, 3.95) * CFrame.Angles(0, (math.pi / 2), 0),
  1632. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, -(math.pi / 2), 0),
  1633. Parent = Body
  1634. }
  1635.  
  1636. local HeadLight = BaseLightPart:Clone()
  1637. HeadLight.Parent = Body
  1638. table.insert(Lights, HeadLight.Light)
  1639. for i, v in pairs(HeadLight:GetChildren()) do
  1640. if v:IsA("Sparkles") then
  1641. table.insert(Sparkles, v)
  1642. end
  1643. end
  1644.  
  1645. local LightWeld = Create("Weld"){
  1646. Part0 = Body,
  1647. Part1 = HeadLight,
  1648. C0 = CFrame.new(0, 0, -3) * CFrame.Angles(0, 0, 0),
  1649. Parent = HeadLight
  1650. }
  1651.  
  1652. local ExhaustPipe = BaseSmokePart:Clone()
  1653. ExhaustPipe.Name = "ExhaustPipe"
  1654. ExhaustPipe.Parent = Body
  1655. table.insert(ExhaustSmoke, ExhaustPipe.ExhaustSmoke)
  1656.  
  1657. local SmokeWeld = Create("Weld"){
  1658. C0 = CFrame.new(0, 0, -8.25) * CFrame.Angles(0, 0, 0),
  1659. Part0 = ExhaustPipe,
  1660. Part1 = Body,
  1661. Parent = ExhaustPipe
  1662. }
  1663.  
  1664. local Tables = {
  1665. ExhaustSmoke = ExhaustSmoke,
  1666. Lights = Lights,
  1667. Sparkles = Sparkles
  1668. }
  1669.  
  1670. return {
  1671. Vehicle = Body,
  1672. Tables = Tables
  1673. }
  1674.  
  1675. end
  1676.  
  1677. for i, v in pairs(MeshData) do
  1678. if type(v) == "table" then
  1679. for ii, vv in pairs(v) do
  1680. if type(vv) == "string" or type(vv) == "number" then
  1681. MeshData[i][ii] = (BaseUrl .. tostring(vv))
  1682. end
  1683. end
  1684. elseif type(v) == "string" or type(v) == "number" then
  1685. MeshData[i] = (BaseUrl .. tostring(v))
  1686. end
  1687. end
  1688.  
  1689. return {
  1690. BaseUrl = BaseUrl,
  1691. MeshData = MeshData,
  1692. CreateVehicle = CreateVehicle
  1693. }
  1694. end))
  1695. RemoteFunction10.Name = "ServerControl"
  1696. RemoteFunction10.Parent = Tool0
  1697. RemoteFunction11.Name = "ClientControl"
  1698. RemoteFunction11.Parent = Tool0
  1699. for i,v in pairs(mas:GetChildren()) do
  1700. v.Parent = workspace
  1701. pcall(function() v:MakeJoints() end)
  1702. end
  1703. mas:Destroy()
  1704. for i,v in pairs(cors) do
  1705. spawn(function()
  1706. pcall(v)
  1707. end)
  1708. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement