Advertisement
scriptaboii

Untitled

May 28th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.14 KB | None | 0 0
  1.  
  2. --made by awesomedudeu
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Animation1 = Instance.new("Animation")
  21. Part2 = Instance.new("Part")
  22. Sound3 = Instance.new("Sound")
  23. Sound4 = Instance.new("Sound")
  24. SpecialMesh5 = Instance.new("SpecialMesh")
  25. Script6 = Instance.new("Script")
  26. LocalScript7 = Instance.new("LocalScript")
  27. LocalScript8 = Instance.new("LocalScript")
  28. ModuleScript9 = Instance.new("ModuleScript")
  29. RemoteFunction10 = Instance.new("RemoteFunction")
  30. RemoteFunction11 = Instance.new("RemoteFunction")
  31. Tool0.Name = "Corolla"
  32. Tool0.Parent = mas
  33. Tool0.TextureId = "rbxassetid://488158554"
  34. 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)
  35. Tool0.GripForward = Vector3.new(3.05171125e-05, -3.05180438e-05, -1)
  36. Tool0.GripPos = Vector3.new(-2.75, 2, -0.75)
  37. Tool0.GripRight = Vector3.new(1, -3.05171125e-05, 3.05180438e-05)
  38. Tool0.GripUp = Vector3.new(3.05180438e-05, 1, -3.05171125e-05)
  39. Animation1.Name = "Hold"
  40. Animation1.Parent = Tool0
  41. Animation1.AnimationId = "http://www.roblox.com/asset/?id=264034706"
  42. Part2.Name = "Handle"
  43. Part2.Parent = Tool0
  44. 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)
  45. Part2.Position = Vector3.new(-235.249954, 3.00001192, 49)
  46. Part2.Size = Vector3.new(0.5, 2, 4)
  47. Part2.BottomSurface = Enum.SurfaceType.Smooth
  48. Part2.TopSurface = Enum.SurfaceType.Smooth
  49. Part2.FormFactor = Enum.FormFactor.Custom
  50. Part2.formFactor = Enum.FormFactor.Custom
  51. Sound3.Name = "Running"
  52. Sound3.Parent = Part2
  53. Sound3.Looped = true
  54. Sound3.EmitterSize = 0
  55. Sound3.MinDistance = 0
  56. Sound3.Pitch = 0.82130032777786
  57. Sound3.PlaybackSpeed = 0.82130032777786
  58. Sound3.SoundId = "http://www.roblox.com/asset/?id=247976926"
  59. Sound4.Name = "Honk"
  60. Sound4.Parent = Part2
  61. Sound4.EmitterSize = 0
  62. Sound4.MinDistance = 0
  63. Sound4.Pitch = 1.1000000238419
  64. Sound4.PlaybackSpeed = 1.1000000238419
  65. Sound4.SoundId = "http://www.roblox.com/asset/?id=248933537"
  66. Sound4.Volume = 0.34999999403954
  67. SpecialMesh5.Parent = Part2
  68. SpecialMesh5.MeshId = "rbxassetid://488158450"
  69. SpecialMesh5.Scale = Vector3.new(0.0700000003, 0.0700000003, 0.0700000003)
  70. SpecialMesh5.TextureId = "rbxassetid://488158554"
  71. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  72. Script6.Parent = Tool0
  73. table.insert(cors,sandbox(Script6,function()
  74. --Made by Luckymaxer
  75. --Updated for R15 avatar by StarWars
  76.  
  77. Tool = script.Parent
  78. Handle = Tool:WaitForChild("Handle")
  79.  
  80. Players = game:GetService("Players")
  81. Debris = game:GetService("Debris")
  82.  
  83. DisplayModel = Tool:FindFirstChild("DisplayModel")
  84. if DisplayModel then
  85. DisplayModel:Destroy()
  86. end
  87.  
  88. Assets = require(Tool:WaitForChild("Assets"))
  89. Data = Assets.Data
  90.  
  91. BaseUrl = Assets.BaseUrl
  92.  
  93. BasePart = Instance.new("Part")
  94. BasePart.Material = Enum.Material.Plastic
  95. BasePart.Shape = Enum.PartType.Block
  96. BasePart.TopSurface = Enum.SurfaceType.Smooth
  97. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  98. BasePart.FormFactor = Enum.FormFactor.Custom
  99. BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
  100. BasePart.Anchored = false
  101. BasePart.CanCollide = true
  102. BasePart.Locked = true
  103.  
  104. Animations = {
  105. Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil}
  106. }
  107.  
  108. Sounds = {
  109. Honk = Handle:WaitForChild("Honk"),
  110. Engine = Handle:WaitForChild("Running")
  111. }
  112.  
  113. Controls = {
  114. Forward = {Key = "w", ByteKey = 17, Mode = false},
  115. Backward = {Key = "s", ByteKey = 18, Mode = false},
  116. Left = {Key = "a", ByteKey = 20, Mode = false},
  117. Right = {Key = "d", ByteKey = 19, Mode = false}
  118. }
  119.  
  120. Rate = (1 / 60)
  121.  
  122. Gravity = 196.20
  123.  
  124. PoseOffset = CFrame.new(0, 0.85, -1) * CFrame.Angles(0, 0, 0) --The offset your character is from the center of the vehicle.
  125.  
  126. SpeedBoost = {
  127. Allowed = false,
  128. Active = false,
  129. Enabled = true,
  130. Duration = 10,
  131. ReloadTime = 30
  132. }
  133.  
  134. Special = {
  135. Allowed = false,
  136. Enabled = true,
  137. Active = false,
  138. Duration = 0,
  139. ReloadTime = 60
  140. }
  141.  
  142. Speed = {
  143. Acceleration = {
  144. Normal = 35,
  145. Boost = 35
  146. },
  147. Deceleration = {
  148. Normal = 30,
  149. Boost = 30
  150. },
  151. MovementSpeed = {
  152. Normal = {Min = 20, Max = 70},
  153. Boost = {Min = 20, Max = 70}
  154. },
  155. TurnSpeed = {
  156. Speed = {Min = 7.5, Max = 7.5},
  157. TurnAlpha = 0.30,
  158. AlphaDampening = 0.2
  159. },
  160. }
  161.  
  162. MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
  163. Movement = Speed.MovementSpeed.Normal,
  164. Turn = Speed.TurnSpeed.Speed,
  165. Acceleration = Speed.Acceleration.Normal,
  166. Deceleration = Speed.Deceleration.Normal
  167. }
  168.  
  169. CurrentSpeed = { --The speed which the vehicle is moving and turning at.
  170. Movement = 0,
  171. Turn = 0
  172. }
  173.  
  174. Honk = {
  175. Honking = false,
  176. LastHonk = 0,
  177. ReloadTime = 1
  178. }
  179.  
  180. Jump = {
  181. Jumping = false,
  182. LastJump = 0,
  183. ReloadTime = 1.9,
  184. JumpForce = 30
  185. }
  186.  
  187. TransparentParts = {}
  188.  
  189. ToolEquipped = false
  190.  
  191. ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  192. ServerControl.Name = "ServerControl"
  193. ServerControl.Parent = Tool
  194.  
  195. ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  196. ClientControl.Name = "ClientControl"
  197. ClientControl.Parent = Tool
  198.  
  199. Tool.Enabled = true
  200.  
  201. function SetTransparency(PrimaryParent, Transparency)
  202. local Parts = {}
  203. local function SetParentTransparency(Parent)
  204. for i, v in pairs(Parent:GetChildren()) do
  205. if v ~= Tool then
  206. if v.Name ~= "HumanoidRootPart" then
  207. local ItemTransparent = false
  208. for ii, vv in pairs(TransparentParts) do
  209. if vv and vv.Part and vv.Part == v then
  210. ItemTransparent = true
  211. end
  212. end
  213. if not ItemTransparent then
  214. pcall(function()
  215. table.insert(Parts, {Part = v, Transparency = v.Transparency})
  216. v.Transparency = Transparency
  217. end)
  218. end
  219. end
  220. SetParentTransparency(v, Transparency)
  221. end
  222. end
  223. end
  224. SetParentTransparency(PrimaryParent)
  225. return Parts
  226. end
  227.  
  228. function CheckTableForString(Table, String)
  229. for i, v in pairs(Table) do
  230. if string.find(string.lower(String), string.lower(v)) then
  231. return true
  232. end
  233. end
  234. return false
  235. end
  236.  
  237. function CheckIntangible(Hit)
  238. local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
  239. if Hit and Hit.Parent then
  240. if CheckTableForString(ProjectileNames, Hit.Name) or Hit.Parent:FindFirstChild("Humanoid") then
  241. return true
  242. end
  243. end
  244. return false
  245. end
  246.  
  247. function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
  248. local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
  249. local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
  250. if RayHit and CheckIntangible(RayHit) then
  251. if DelayIfHit then
  252. wait()
  253. end
  254. RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
  255. end
  256. return RayHit, RayPos, RayNormal
  257. end
  258.  
  259. function GetAllConnectedParts(Object)
  260. local Parts = {}
  261. local function GetConnectedParts(Object)
  262. for i, v in pairs(Object:GetConnectedParts()) do
  263. local Ignore = false
  264. for ii, vv in pairs(Parts) do
  265. if v == vv then
  266. Ignore = true
  267. end
  268. end
  269. if not Ignore then
  270. table.insert(Parts, v)
  271. GetConnectedParts(v)
  272. end
  273. end
  274. end
  275. GetConnectedParts(Object)
  276. return Parts
  277. end
  278.  
  279. function EnableFirstPersonView()
  280. if not CheckIfAlive() or not ToolEquipped then
  281. return
  282. end
  283. local Limbs = {}
  284.  
  285. if Humanoid then
  286. if Humanoid.RigType == Enum.HumanoidRigType.R6 then
  287. Limbs = {"Left Arm", "Right Arm"}
  288. elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
  289. Limbs = {"LeftLowerArm", "LeftUpperArm", "LeftHand", "RightLowerArm", "RightUpperArm", "RightHand"}
  290. end
  291. end
  292. for i, v in pairs(Limbs) do
  293. local Limb = Character:FindFirstChild(v)
  294. if Limb:IsA("BasePart") then
  295. Spawn(function()
  296. InvokeClient("SetLocalTransparencyModifier", {Object = Limb, Transparency = 0, AutoUpdate = false})
  297. end)
  298. end
  299. end
  300. end
  301.  
  302. function GetLookVectorAngle(Direction)
  303. local Angle = math.acos(Direction:Dot(Vector3.new(1, 0, 0)))
  304. local Modifier = math.acos(Direction:Dot(Vector3.new(0, 0, -1)))
  305. return (Angle * (Modifier > (math.pi / 2) and -1 or 1))
  306. end
  307.  
  308. function GetCFrameAngle(CFrame)
  309. local Vector1 = CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Top))
  310. local Vector2 = Vector3.new(0, 1, 0)
  311. local Angle = math.acos(Vector1:Dot(Vector2))
  312. return Angle
  313. end
  314.  
  315. function ThrustUpdater()
  316.  
  317. for i, v in pairs(CurrentSpeed) do
  318. CurrentSpeed[i] = 0
  319. end
  320. for i, v in pairs(Controls) do
  321. Controls[i].Mode = false
  322. end
  323.  
  324. 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
  325.  
  326. RotationForce.angularvelocity = Vector3.new(0, CurrentSpeed.Turn, 0)
  327. if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
  328. CurrentSpeed.Turn = (CurrentSpeed.Turn - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
  329. else
  330. CurrentSpeed.Turn = 0
  331. end
  332.  
  333. if not Controls.Forward.Mode or Controls.Backward.Mode then --Slow down if not controlling.
  334. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.99)
  335. end
  336.  
  337. local MySpeed = Vector3.new(Body.Velocity.X, 0, Body.Velocity.Z).magnitude
  338. local VelocityDifference = math.abs((MySpeed - (ThrustForce.velocity.magnitude)))
  339. if MySpeed > 3 and ThrustForce.velocity.magnitude > 3 and VelocityDifference > (0.7 * ThrustForce.velocity.magnitude) then
  340. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.9)
  341. end
  342.  
  343. if Controls.Forward.Mode then --Handle acceleration
  344. CurrentSpeed.Movement = math.min(MaxSpeed.Movement.Max, (CurrentSpeed.Movement + (MaxSpeed.Acceleration * Rate)))
  345. end
  346. if Controls.Backward.Mode then --Handle deceleration, if speed is more than 0, decrease quicker.
  347. CurrentSpeed.Movement = math.max(-MaxSpeed.Movement.Min, (CurrentSpeed.Movement - (MaxSpeed.Deceleration * ((CurrentSpeed.Movement > 0 and 2.8) or 1) * Rate)))
  348. end
  349.  
  350. if (Controls.Forward.Mode or Controls.Backward.Mode) or CurrentSpeed.Movement >= (MaxSpeed.Movement.Max * 0.35) then
  351. if Controls.Left.Mode then --Handle left turn speed
  352. CurrentSpeed.Turn = math.min(Speed.TurnSpeed.Speed.Max, (CurrentSpeed.Turn + (Speed.TurnSpeed.TurnAlpha)))
  353. end
  354. if Controls.Right.Mode then --Handle right turn speed
  355. CurrentSpeed.Turn = math.max(-Speed.TurnSpeed.Speed.Min, (CurrentSpeed.Turn - (Speed.TurnSpeed.TurnAlpha)))
  356. end
  357. end
  358.  
  359. local Direction = Torso.CFrame.lookVector
  360. Direction = Vector3.new(Direction.x, 0, Direction.z).unit
  361.  
  362. local Velocity = (Direction * CurrentSpeed.Movement) --The thrust force which you move.
  363. ThrustForce.velocity = Vector3.new(Velocity.X, ThrustForce.velocity.Y, Velocity.Z)
  364.  
  365. local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 4) --Amount your character leans over.
  366. local XZAngle = math.atan2(Torso.CFrame.lookVector.z, 0, Torso.CFrame.lookVector.x) --Handle rotation
  367. --TurnGyro.cframe = CFrame.Angles((LeanAmount * Direction.X), 0, (LeanAmount * Direction.Z))
  368.  
  369. local RayPositions = {
  370. (Torso.CFrame * CFrame.new(0, 0, 0)),
  371. (Torso.CFrame * CFrame.new(0, 0, -((Body.Size.Z / 2) * 1))),
  372. (Torso.CFrame * CFrame.new(0, 0, ((Body.Size.Z / 2) * 1))),
  373. }
  374. local HighestPoint = {RayHit = nil, RayPos = nil, RayNormal = nil}
  375. for i, v in pairs(RayPositions) do
  376. local RayHit, RayPos, RayNormal = CastRay(v.p, Vector3.new(0, -1, 0), (Body.Size.Y * 2), {Character}, false)
  377. if RayHit and (not HighestPoint.RayPos or RayPos.Y > HighestPoint.RayPos.Y) then
  378. HighestPoint = {RayHit = RayHit, RayPos = RayPos, RayNormal = RayNormal}
  379. end
  380. end
  381. local AngleX, AngleY, AngleZ = Body.CFrame:toEulerAnglesXYZ()
  382. 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)
  383. TurnGyro.cframe = (((HighestPoint.RayHit and Direction and GetCFrameAngle(Direction) < (math.pi / 1.25)) and Direction) or CFrame.new(0, 0, 0))
  384.  
  385. --Wheel animation
  386. local DesiredAngle = (999999999 * (-CurrentSpeed.Movement / math.abs(CurrentSpeed.Movement)))
  387. local MaxVelocity = (CurrentSpeed.Movement / 250)
  388. for i, v in pairs({FrontLeftMotor, FrontRightMotor, BackLeftMotor, BackRightMotor}) do
  389. if v and v.Parent then
  390. v.DesiredAngle = DesiredAngle
  391. v.MaxVelocity = MaxVelocity
  392. end
  393. end
  394.  
  395. --Smoke exhaust from vehicle running.
  396. for i, v in pairs(ExhaustSmoke) do
  397. if v and v.Parent then
  398. v.Opacity = ((math.min(math.abs(CurrentSpeed.Movement), 10) / 10) * 0.5)
  399. end
  400. end
  401.  
  402. --Engine running sound which pitch changes while in motion.
  403. Sounds.Engine.Pitch = (0.75 + (math.abs(CurrentSpeed.Movement / MaxSpeed.Movement.Max) * 1))
  404.  
  405. wait(Rate)
  406.  
  407. end
  408. end
  409.  
  410. function SpawnVehicle()
  411.  
  412. Handle.Transparency = 1
  413.  
  414. Spawn(function()
  415. InvokeClient("PlaySound", Sounds.Engine)
  416. InvokeClient("PlayAnimation", Animations.Hold)
  417. end)
  418.  
  419. Humanoid.AutoRotate = false
  420. Humanoid.PlatformStand = true
  421. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  422.  
  423. local VehicleData = Assets.CreateVehicle()
  424. Body = VehicleData.Vehicle
  425. local ParticleTable = VehicleData.Tables
  426.  
  427. FrontLeftMotor = Body.FrontLeftMotor
  428. FrontRightMotor = Body.FrontRightMotor
  429. BackLeftMotor = Body.BackLeftMotor
  430. BackRightMotor = Body.BackRightMotor
  431.  
  432. ExhaustSmoke = ParticleTable.ExhaustSmoke
  433. Lights = ParticleTable.Lights
  434. Sparkles = ParticleTable.Sparkles
  435.  
  436. if SpeedBoost.Active then
  437. for i, v in pairs(Sparkles) do
  438. if v and v.Parent then
  439. v.Enabled = true
  440. end
  441. end
  442. end
  443.  
  444. local TorsoWeld = Instance.new("Weld")
  445. TorsoWeld.C0 = PoseOffset
  446. TorsoWeld.Part0 = Torso
  447. TorsoWeld.Part1 = Body
  448. TorsoWeld.Parent = Body
  449.  
  450. Body.CanCollide = true
  451.  
  452. local BaseTransparency = 1
  453. TransparentParts = SetTransparency(Character, BaseTransparency)
  454. ItemAdded = Character.ChildAdded:connect(function(Child)
  455. for i, v in pairs(SetTransparency(Child, BaseTransparency)) do
  456. table.insert(TransparentParts, v)
  457. end
  458. end)
  459. ItemRemoved = Character.ChildRemoved:connect(function(Child)
  460. for i, v in pairs(Child:GetChildren()) do
  461. for ii, vv in pairs(TransparentParts) do
  462. if vv.Part == v then
  463. vv.Part.Transparency = vv.Transparency
  464. table.remove(TransparentParts, ii)
  465. end
  466. end
  467. end
  468. end)
  469.  
  470. RotationForce = Instance.new("BodyAngularVelocity")
  471. RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
  472. RotationForce.angularvelocity = Vector3.new(0, 0, 0)
  473. RotationForce.Parent = Torso
  474.  
  475. ThrustForce = Instance.new("BodyVelocity")
  476. ThrustForce.maxForce = Vector3.new(math.huge, 0, math.huge)
  477. ThrustForce.velocity = Vector3.new(0, 0, 0)
  478. ThrustForce.P = 100
  479. ThrustForce.Parent = Torso
  480.  
  481. TurnGyro = Instance.new("BodyGyro")
  482. TurnGyro.maxTorque = Vector3.new(math.huge, 0, math.huge)
  483. TurnGyro.P = 300
  484. TurnGyro.D = 100
  485. TurnGyro.Parent = Torso
  486.  
  487. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2.5), {Character}, false)
  488. if RayHit then
  489. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  490. end
  491.  
  492. Body.CFrame = Torso.CFrame
  493. Body.Parent = Tool
  494.  
  495. Spawn(ThrustUpdater)
  496.  
  497. end
  498.  
  499. function FreezePlayer()
  500. if CheckIfAlive() then
  501. local FreezePart = BasePart:Clone()
  502. FreezePart.Name = "FreezePart"
  503. FreezePart.Transparency = 1
  504. FreezePart.Anchored = true
  505. FreezePart.CanCollide = false
  506. local FreezeWeld = Instance.new("Weld")
  507. FreezeWeld.Part0 = Torso
  508. FreezeWeld.Part1 = FreezePart
  509. FreezeWeld.Parent = FreezePart
  510. Debris:AddItem(FreezePart, 0.125)
  511. FreezePart.Parent = Character
  512. Torso.Velocity = Vector3.new(0, -25, 0)
  513. Torso.RotVelocity = Vector3.new(0, 0, 0)
  514. end
  515. end
  516.  
  517. function CleanUp()
  518. Handle.Velocity = Vector3.new(0, 0, 0)
  519. Handle.RotVelocity = Vector3.new(0, 0, 0)
  520. for i, v in pairs(TransparentParts) do
  521. if v and v.Part and v.Part.Parent then
  522. v.Part.Transparency = v.Transparency
  523. end
  524. end
  525. TransparentParts = {}
  526. for i, v in pairs({ItemAdded, ItemRemoved}) do
  527. if v then
  528. v:disconnect()
  529. end
  530. end
  531. for i, v in pairs({Body, RotationForce, ThrustForce, TurnGyro}) do
  532. if v and v.Parent then
  533. v:Destroy()
  534. end
  535. end
  536. for i, v in pairs(Tool:GetChildren()) do
  537. if v:IsA("BasePart") and v ~= Handle then
  538. v:Destroy()
  539. end
  540. end
  541. end
  542.  
  543. function CheckIfAlive()
  544. 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)
  545. end
  546.  
  547. function Equipped(Mouse)
  548. Character = Tool.Parent
  549. Player = Players:GetPlayerFromCharacter(Character)
  550. Humanoid = Character:FindFirstChild("Humanoid")
  551. Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
  552. if not CheckIfAlive() then
  553. return
  554. end
  555. Spawn(CleanUp)
  556. --Spawn(EnableFirstPersonView)
  557. Spawn(SpawnVehicle)
  558.  
  559. ToolEquipped = true
  560. end
  561.  
  562. function Unequipped()
  563. Spawn(CleanUp)
  564. Spawn(FreezePlayer)
  565. for i, v in pairs(Sounds) do
  566. v:Stop()
  567. Spawn(function()
  568. InvokeClient("StopSound", v)
  569. end)
  570. end
  571. if CheckIfAlive() then
  572. Humanoid.CameraOffset = Vector3.new(0, 0, 0)
  573. Humanoid.AutoRotate = true
  574. Humanoid.PlatformStand = false
  575. local RayHit, RayPos, RayNormal = CastRay(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character}, false)
  576. if RayHit then
  577. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  578. end
  579. end
  580. Handle.Transparency = 0
  581. ToolEquipped = false
  582. end
  583.  
  584. function OnServerInvoke(player, mode, value)
  585. if player == Player and ToolEquipped and value and CheckIfAlive() then
  586. if mode == "KeyPress" then
  587. local Down = value.Down
  588. local Key = value.Key
  589. local ByteKey = string.byte(Key)
  590. for i, v in pairs(Controls) do
  591. if Key == v.Key or ByteKey == v.ByteKey then
  592. Controls[i].Mode = Down
  593. end
  594. end
  595. if Key == " " and Down then --Jump controller
  596. if math.abs(tick() - Jump.LastJump) > Jump.ReloadTime and not Jump.Jumping and ThrustForce and ThrustForce.Parent then
  597. Jump.Jumping = true
  598. local Parts = GetAllConnectedParts(Body)
  599. local Mass = 0
  600. for i, v in pairs(Parts) do
  601. Mass = (Mass + v:GetMass())
  602. end
  603. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, ((Mass * Gravity) * 100), ThrustForce.maxForce.Z)
  604. ThrustForce.velocity = (Vector3.new(0, 1, 0) * Jump.JumpForce) + Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  605. wait(0.1)
  606. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, 0, ThrustForce.maxForce.Z)
  607. ThrustForce.velocity = Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  608. Jump.LastJump = tick()
  609. Jump.Jumping = false
  610. end
  611. elseif Key == "x" and Down then --Toggle light(s) on/off.
  612. for i, v in pairs(Lights) do
  613. if v and v.Parent then
  614. v.Enabled = not v.Enabled
  615. end
  616. end
  617. elseif Key == "h" and Down then --Play honk sound.
  618. local Sound = Sounds.Honk
  619. if (tick() - Honk.LastHonk) >= (Sound.TimeLength + Honk.ReloadTime) and not Honk.Honking then
  620. Honk.Honking = true
  621. local TempSound = Sound:Clone()
  622. Debris:AddItem(TempSound, Sound.TimeLength)
  623. TempSound.Parent = Body
  624. TempSound:Play()
  625. Honk.LastHonk = tick()
  626. Honk.Honking = false
  627. end
  628. elseif Key == "q" and Down then --Activate special.
  629. if not Special.Allowed or not Special.Enabled or Special.Active then
  630. return
  631. end
  632. Special.Enabled = false
  633. Special.Active = true
  634. wait(Special.Duration)
  635. Special.Active = false
  636. wait(Special.ReloadTime)
  637. Special.Enabled = true
  638. elseif ByteKey == 48 and Down then --Activate speed boost.
  639. if not SpeedBoost.Allowed or not SpeedBoost.Enabled or SpeedBoost.Active then
  640. return
  641. end
  642. SpeedBoost.Enabled = false
  643. SpeedBoost.Active = true
  644. for i, v in pairs(Sparkles) do
  645. if v and v.Parent then
  646. v.Enabled = true
  647. end
  648. end
  649. MaxSpeed.Acceleration = Speed.Acceleration.Boost
  650. MaxSpeed.Deceleration = Speed.Deceleration.Boost
  651. MaxSpeed.Movement = Speed.MovementSpeed.Boost
  652. wait(SpeedBoost.Duration)
  653. MaxSpeed.Acceleration = Speed.Acceleration.Normal
  654. MaxSpeed.Deceleration = Speed.Deceleration.Normal
  655. MaxSpeed.Movement = Speed.MovementSpeed.Normal
  656. for i, v in pairs(Sparkles) do
  657. if v and v.Parent then
  658. v.Enabled = false
  659. end
  660. end
  661. SpeedBoost.Active = false
  662. wait(SpeedBoost.ReloadTime)
  663. SpeedBoost.Enabled = true
  664. end
  665. end
  666. end
  667. end
  668.  
  669. function InvokeClient(Mode, Value)
  670. local ClientReturn = nil
  671. pcall(function()
  672. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  673. end)
  674. return ClientReturn
  675. end
  676.  
  677. Spawn(CleanUp)
  678.  
  679. Tool.Changed:connect(function(Property)
  680. if Property == "Parent" and Tool.Parent then
  681. Handle.Transparency = (((not Tool.Parent:IsA("Backpack") and not Players:GetPlayerFromCharacter(Tool.Parent)) and 0) or 1)
  682. end
  683. end)
  684.  
  685. ServerControl.OnServerInvoke = OnServerInvoke
  686. Tool.Equipped:connect(Equipped)
  687. Tool.Unequipped:connect(Unequipped)
  688. end))
  689. LocalScript7.Name = "MouseIcon"
  690. LocalScript7.Parent = Tool0
  691. table.insert(cors,sandbox(LocalScript7,function()
  692. --Made by Luckymaxer
  693.  
  694. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  695. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  696.  
  697. Tool = script.Parent
  698.  
  699. Mouse = nil
  700.  
  701. function UpdateIcon()
  702. if Mouse then
  703. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  704. end
  705. end
  706.  
  707. function OnEquipped(ToolMouse)
  708. Mouse = ToolMouse
  709. UpdateIcon()
  710. end
  711.  
  712. function OnChanged(Property)
  713. if Property == "Enabled" then
  714. UpdateIcon()
  715. end
  716. end
  717.  
  718. Tool.Equipped:connect(OnEquipped)
  719. Tool.Changed:connect(OnChanged)
  720. end))
  721. LocalScript8.Parent = Tool0
  722. table.insert(cors,sandbox(LocalScript8,function()
  723. --Made by Luckymaxer
  724.  
  725. Tool = script.Parent
  726. Handle = Tool:WaitForChild("Handle")
  727.  
  728. Players = game:GetService("Players")
  729. RunService = game:GetService("RunService")
  730.  
  731. Camera = game:GetService("Workspace").CurrentCamera
  732.  
  733. Animations = {}
  734. LocalObjects = {}
  735.  
  736. ServerControl = Tool:WaitForChild("ServerControl")
  737. ClientControl = Tool:WaitForChild("ClientControl")
  738.  
  739. ToolEquipped = false
  740.  
  741. function SetAnimation(mode, value)
  742. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  743. for i, v in pairs(Animations) do
  744. if v.Animation == value.Animation then
  745. v.AnimationTrack:Stop()
  746. table.remove(Animations, i)
  747. end
  748. end
  749. local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
  750. table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
  751. AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
  752. elseif mode == "StopAnimation" and value then
  753. for i, v in pairs(Animations) do
  754. if v.Animation == value.Animation then
  755. v.AnimationTrack:Stop()
  756. table.remove(Animations, i)
  757. end
  758. end
  759. end
  760. end
  761.  
  762. function DisableJump(Boolean)
  763. if PreventJump then
  764. PreventJump:disconnect()
  765. end
  766. if Boolean then
  767. PreventJump = Humanoid.Changed:connect(function(Property)
  768. if Property == "Jump" then
  769. Humanoid.Jump = false
  770. end
  771. end)
  772. end
  773. end
  774.  
  775. function CheckIfAlive()
  776. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
  777. end
  778.  
  779. function Equipped(Mouse)
  780. Character = Tool.Parent
  781. Player = Players:GetPlayerFromCharacter(Character)
  782. Humanoid = Character:FindFirstChild("Humanoid")
  783. ToolEquipped = true
  784. if not CheckIfAlive() then
  785. return
  786. end
  787. PlayerMouse = Player:GetMouse()
  788. Mouse.Button1Down:connect(function()
  789. InvokeServer("MouseClick", {Down = true})
  790. end)
  791. Mouse.Button1Up:connect(function()
  792. InvokeServer("MouseClick", {Down = false})
  793. end)
  794. Mouse.KeyDown:connect(function(Key)
  795. InvokeServer("KeyPress", {Key = Key, Down = true})
  796. end)
  797. Mouse.KeyUp:connect(function(Key)
  798. InvokeServer("KeyPress", {Key = Key, Down = false})
  799. end)
  800. Mouse.Move:connect(function()
  801. InvokeServer("MouseMove", {Position = Mouse.Hit.p, Target = Mouse.Target})
  802. end)
  803. Humanoid:ChangeState(Enum.HumanoidStateType.None)
  804. end
  805.  
  806. function Unequipped()
  807. ToolEquipped = false
  808. LocalObjects = {}
  809. for i, v in pairs(Animations) do
  810. if v and v.AnimationTrack then
  811. v.AnimationTrack:Stop()
  812. end
  813. end
  814. for i, v in pairs({PreventJump, ObjectLocalTransparencyModifier}) do
  815. if v then
  816. v:disconnect()
  817. end
  818. end
  819. Humanoid:ChangeState(Enum.HumanoidStateType.Freefall) --Prevent the ability to fly by constantly equipping and unequipping the tool.
  820. Animations = {}
  821. end
  822.  
  823. function InvokeServer(mode, value)
  824. pcall(function()
  825. local ServerReturn = ServerControl:InvokeServer(mode, value)
  826. return ServerReturn
  827. end)
  828. end
  829.  
  830. function OnClientInvoke(mode, value)
  831. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  832. SetAnimation("PlayAnimation", value)
  833. elseif mode == "StopAnimation" and value then
  834. SetAnimation("StopAnimation", value)
  835. elseif mode == "PlaySound" and value then
  836. value:Play()
  837. elseif mode == "StopSound" and value then
  838. value:Stop()
  839. elseif mode == "MousePosition" then
  840. return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
  841. elseif mode == "DisableJump" then
  842. DisableJump(value)
  843. elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
  844. pcall(function()
  845. local ObjectFound = false
  846. for i, v in pairs(LocalObjects) do
  847. if v == value then
  848. ObjectFound = true
  849. end
  850. end
  851. if not ObjectFound then
  852. table.insert(LocalObjects, value)
  853. if ObjectLocalTransparencyModifier then
  854. ObjectLocalTransparencyModifier:disconnect()
  855. end
  856. ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
  857. for i, v in pairs(LocalObjects) do
  858. if v.Object and v.Object.Parent then
  859. local CurrentTransparency = v.Object.LocalTransparencyModifier
  860. if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
  861. v.Object.LocalTransparencyModifier = v.Transparency
  862. end
  863. else
  864. table.remove(LocalObjects, i)
  865. end
  866. end
  867. end)
  868. end
  869. end)
  870. end
  871. end
  872.  
  873. ClientControl.OnClientInvoke = OnClientInvoke
  874. Tool.Equipped:connect(Equipped)
  875. Tool.Unequipped:connect(Unequipped)
  876. end))
  877. ModuleScript9.Name = "Assets"
  878. ModuleScript9.Parent = Tool0
  879. table.insert(cors,sandbox(ModuleScript9,function()
  880. --Made by Luckymaxer
  881.  
  882. BaseUrl = "http://www.roblox.com/asset/?id="
  883.  
  884. RbxUtility = LoadLibrary("RbxUtility")
  885. Create = RbxUtility.Create
  886.  
  887. BasePart = Create("Part"){
  888. Material = Enum.Material.Plastic,
  889. Shape = Enum.PartType.Block,
  890. TopSurface = Enum.SurfaceType.Smooth,
  891. BottomSurface = Enum.SurfaceType.Smooth,
  892. FormFactor = Enum.FormFactor.Custom,
  893. Size = Vector3.new(0.2, 0.2, 0.2),
  894. Anchored = false,
  895. CanCollide = true,
  896. Locked = true
  897. }
  898.  
  899. MeshData = {
  900. Meshes = {
  901. Body = 488158450,
  902. Wheel = 0,
  903. },
  904. TextureId = 488158554,
  905. }
  906.  
  907. function CreateVehicle()
  908.  
  909. local ExhaustSmoke = {}
  910. local Lights = {}
  911. local Sparkles = {}
  912.  
  913. local Body = BasePart:Clone()
  914. Body.Name = "Body"
  915. Body.Size = Vector3.new(6.25, 3.9, 12)
  916. local BodyMesh = Create("SpecialMesh"){
  917. MeshType = Enum.MeshType.FileMesh,
  918. MeshId = MeshData.Meshes.Body,
  919. TextureId = MeshData.TextureId,
  920. Scale = Vector3.new(0.07, 0.07, 0.07),
  921. VertexColor = Vector3.new(1, 1, 1),
  922. Offset = Vector3.new(0, 0.2, 0),
  923. Parent = Body
  924. }
  925.  
  926. local BaseWheel = BasePart:Clone()
  927. BaseWheel.Size = Vector3.new(0.5, 1, 1)
  928. BaseWheel.CanCollide = false
  929. local WheelMesh = Create("SpecialMesh"){
  930. MeshType = Enum.MeshType.FileMesh,
  931. MeshId = MeshData.Meshes.Wheel,
  932. TextureId = MeshData.TextureId,
  933. Scale = Vector3.new(1.6, 1.6, 1.6),
  934. VertexColor = Vector3.new(1, 1, 1),
  935. Offset = Vector3.new(0, 0, 0),
  936. Parent = BaseWheel,
  937. }
  938.  
  939. local BaseFrontWheel = BaseWheel:Clone()
  940. BaseFrontWheel.Name = "FrontWheel"
  941.  
  942. local BaseBackWheel = BaseWheel:Clone()
  943. BaseBackWheel.Name = "BackWheel"
  944.  
  945. local BaseSmokePart = BasePart:Clone()
  946. BaseSmokePart.Name = "SmokePart"
  947. BaseSmokePart.Transparency = 1
  948. BaseSmokePart.CanCollide = false
  949. local BaseExhaustSmoke = Create("Smoke"){
  950. Name = "ExhaustSmoke",
  951. Size = 0.1,
  952. RiseVelocity = 0.01,
  953. Color = Color3.new((127 / 255), (127 / 255), (127 / 255)),
  954. Enabled = true,
  955. Parent = BaseSmokePart,
  956. }
  957.  
  958. local BaseLightPart = BasePart:Clone()
  959. BaseLightPart.Name = "LightPart"
  960. BaseLightPart.Transparency = 1
  961. BaseLightPart.CanCollide = false
  962. local Light = Create("SpotLight"){
  963. Name = "Light",
  964. Brightness = 5,
  965. Angle = 45,
  966. Color = Color3.new(255 / 255, 252 / 255, 153 / 255),
  967. Range = 30,
  968. Shadows = false,
  969. Enabled = false,
  970. Parent = BaseLightPart,
  971. }
  972.  
  973. local FrontLeftWheel = BaseFrontWheel:Clone()
  974. FrontLeftWheel.Name = "FrontLeftWheel"
  975. FrontLeftWheel.Parent = Body
  976.  
  977. local FrontLeftMotor = Create("Motor6D"){
  978. Name = "FrontLeftMotor",
  979. Part0 = Body,
  980. Part1 = FrontLeftWheel,
  981. C0 = CFrame.new(-2.25, -1.1, -3.25) * CFrame.Angles(0, (math.pi / 2), 0),
  982. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, (math.pi / 2), 0),
  983. Parent = Body
  984. }
  985.  
  986. local FrontRightWheel = BaseFrontWheel:Clone()
  987. FrontRightWheel.Name = "FrontRightWheel"
  988. FrontRightWheel.Parent = Body
  989.  
  990. local FrontRightMotor = Create("Motor6D"){
  991. Name = "FrontRightMotor",
  992. Part0 = Body,
  993. Part1 = FrontRightWheel,
  994. C0 = CFrame.new(2.25, -1.1, -3.25) * CFrame.Angles(0, (math.pi / 2), 0),
  995. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, -(math.pi / 2), 0),
  996. Parent = Body
  997. }
  998.  
  999. local BackLeftWheel = BaseBackWheel:Clone()
  1000. BackLeftWheel.Name = "BackLeftWheel"
  1001. BackLeftWheel.Parent = Body
  1002.  
  1003. local BackLeftMotor = Create("Motor6D"){
  1004. Name = "BackLeftMotor",
  1005. Part0 = Body,
  1006. Part1 = BackLeftWheel,
  1007. C0 = CFrame.new(-2.25, -1.1, 3.95) * CFrame.Angles(0, (math.pi / 2), 0),
  1008. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, (math.pi / 2), 0),
  1009. Parent = Body
  1010. }
  1011.  
  1012. local BackRightWheel = BackLeftWheel:Clone()
  1013. BackRightWheel.Name = "BackRightWheel"
  1014. BackRightWheel.Parent = Body
  1015.  
  1016. local BackRightMotor = Create("Motor6D"){
  1017. Name = "BackRightMotor",
  1018. Part0 = Body,
  1019. Part1 = BackRightWheel,
  1020. C0 = CFrame.new(2.25, -1.1, 3.95) * CFrame.Angles(0, (math.pi / 2), 0),
  1021. C1 = CFrame.new(0, -0.1, 0) * CFrame.Angles(0, -(math.pi / 2), 0),
  1022. Parent = Body
  1023. }
  1024.  
  1025. local HeadLight = BaseLightPart:Clone()
  1026. HeadLight.Parent = Body
  1027. table.insert(Lights, HeadLight.Light)
  1028. for i, v in pairs(HeadLight:GetChildren()) do
  1029. if v:IsA("Sparkles") then
  1030. table.insert(Sparkles, v)
  1031. end
  1032. end
  1033.  
  1034. local LightWeld = Create("Weld"){
  1035. Part0 = Body,
  1036. Part1 = HeadLight,
  1037. C0 = CFrame.new(0, 0, -3) * CFrame.Angles(0, 0, 0),
  1038. Parent = HeadLight
  1039. }
  1040.  
  1041. local ExhaustPipe = BaseSmokePart:Clone()
  1042. ExhaustPipe.Name = "ExhaustPipe"
  1043. ExhaustPipe.Parent = Body
  1044. table.insert(ExhaustSmoke, ExhaustPipe.ExhaustSmoke)
  1045.  
  1046. local SmokeWeld = Create("Weld"){
  1047. C0 = CFrame.new(0, 0, -8.25) * CFrame.Angles(0, 0, 0),
  1048. Part0 = ExhaustPipe,
  1049. Part1 = Body,
  1050. Parent = ExhaustPipe
  1051. }
  1052.  
  1053. local Tables = {
  1054. ExhaustSmoke = ExhaustSmoke,
  1055. Lights = Lights,
  1056. Sparkles = Sparkles
  1057. }
  1058.  
  1059. return {
  1060. Vehicle = Body,
  1061. Tables = Tables
  1062. }
  1063.  
  1064. end
  1065.  
  1066. for i, v in pairs(MeshData) do
  1067. if type(v) == "table" then
  1068. for ii, vv in pairs(v) do
  1069. if type(vv) == "string" or type(vv) == "number" then
  1070. MeshData[i][ii] = (BaseUrl .. tostring(vv))
  1071. end
  1072. end
  1073. elseif type(v) == "string" or type(v) == "number" then
  1074. MeshData[i] = (BaseUrl .. tostring(v))
  1075. end
  1076. end
  1077.  
  1078. return {
  1079. BaseUrl = BaseUrl,
  1080. MeshData = MeshData,
  1081. CreateVehicle = CreateVehicle
  1082. }
  1083. end))
  1084. RemoteFunction10.Name = "ServerControl"
  1085. RemoteFunction10.Parent = Tool0
  1086. RemoteFunction11.Name = "ClientControl"
  1087. RemoteFunction11.Parent = Tool0
  1088. for i,v in pairs(mas:GetChildren()) do
  1089. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1090. pcall(function() v:MakeJoints() end)
  1091. end
  1092. mas:Destroy()
  1093. for i,v in pairs(cors) do
  1094. spawn(function()
  1095. pcall(v)
  1096. end)
  1097. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement