lolita5432

mlg hyper bike

Dec 24th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.75 KB | None | 0 0
  1. --made by youtube : Intensivelake39/discord: bad#5159/roblox : ttatatataat7777
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Tool0 = Instance.new("Tool")
  19. Script1 = Instance.new("Script")
  20. Script2 = Instance.new("Script")
  21. LocalScript3 = Instance.new("LocalScript")
  22. Animation4 = Instance.new("Animation")
  23. Color3Value5 = Instance.new("Color3Value")
  24. LocalScript6 = Instance.new("LocalScript")
  25. Part7 = Instance.new("Part")
  26. SpecialMesh8 = Instance.new("SpecialMesh")
  27. Sound9 = Instance.new("Sound")
  28. Sound10 = Instance.new("Sound")
  29. Tool0.Name = "MLG HYPERBIKE"
  30. Tool0.Parent = mas
  31. Tool0.TextureId = "http://www.roblox.com/asset/?id=212658181"
  32. Tool0.GripPos = Vector3.new(1.5, 2.20000005, -2)
  33. Script1.Parent = Tool0
  34. table.insert(cors,sandbox(Script1,function()
  35. --Made by Luckymaxer
  36.  
  37. Tool = script.Parent
  38. Handle = Tool:WaitForChild("Handle")
  39.  
  40. Players = game:GetService("Players")
  41. Debris = game:GetService("Debris")
  42.  
  43. Assets = require(Tool:WaitForChild("Assets"))
  44. Data = Assets.Data
  45.  
  46. ColorValue = Tool:WaitForChild("CurrentColor")
  47.  
  48. BaseUrl = Assets.BaseUrl
  49.  
  50. BasePart = Instance.new("Part")
  51. BasePart.Material = Enum.Material.Plastic
  52. BasePart.Shape = Enum.PartType.Block
  53. BasePart.TopSurface = Enum.SurfaceType.Smooth
  54. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  55. BasePart.FormFactor = Enum.FormFactor.Custom
  56. BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
  57. BasePart.Anchored = false
  58. BasePart.CanCollide = true
  59. BasePart.Locked = true
  60.  
  61. Colors = {
  62. {Texture = 256465742, Color = BrickColor.new("Institutional white")}, --Red
  63. {Texture = 256465742, Color = BrickColor.new("Lime green")}, --Orange
  64. {Texture = 256465742, Color = BrickColor.new("Bright red")}, --Green
  65. {Texture = 256465742, Color = BrickColor.new("Really black")}, --Blue
  66. {Texture = 256465742, Color = BrickColor.new("Crimson")}, --Light Blue
  67. {Texture = 256465742, Color = BrickColor.new("Bright orange")}, --Magenta
  68. }
  69.  
  70. CurrentColor = 0
  71. CycleTick = 0
  72. CycleTime = 1
  73.  
  74. Animations = {
  75. Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil}
  76. }
  77.  
  78. Sounds = {
  79. Honk = Handle:WaitForChild("Honk"),
  80. Engine = Handle:WaitForChild("Running")
  81. }
  82.  
  83. Controls = {
  84. Forward = {Key = "w", ByteKey = 17, Mode = false},
  85. Backward = {Key = "s", ByteKey = 18, Mode = false},
  86. Left = {Key = "a", ByteKey = 20, Mode = false},
  87. Right = {Key = "d", ByteKey = 19, Mode = false}
  88. }
  89.  
  90. Rate = (1 / 60)
  91.  
  92. Gravity = 196.20
  93.  
  94. PoseOffset = CFrame.new(0, -2, 0.5) * CFrame.Angles(0, 0, 0) --The offset your character is from the center of the vehicle.
  95.  
  96. SpeedBoost = {
  97. Allowed = false,
  98. Active = false,
  99. Enabled = true,
  100. Duration = 10,
  101. ReloadTime = 30
  102. }
  103.  
  104. Special = {
  105. Allowed = false,
  106. Enabled = true,
  107. Active = false,
  108. Duration = 0,
  109. ReloadTime = 60
  110. }
  111.  
  112. Speed = {
  113. Acceleration = {
  114. Normal = 150,
  115. Boost = 300
  116. },
  117. Deceleration = {
  118. Normal = 150,
  119. Boost = 300
  120. },
  121. MovementSpeed = {
  122. Normal = {Min = 150, Max = 300},
  123. Boost = {Min = 150, Max = 300}
  124. },
  125. TurnSpeed = {
  126. Speed = {Min = 5, Max = 5},
  127. TurnAlpha = 0.30,
  128. AlphaDampening = 0.2
  129. },
  130. }
  131.  
  132. MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
  133. Movement = Speed.MovementSpeed.Normal,
  134. Turn = Speed.TurnSpeed.Speed,
  135. Acceleration = Speed.Acceleration.Normal,
  136. Deceleration = Speed.Deceleration.Normal
  137. }
  138.  
  139. CurrentSpeed = { --The speed which the vehicle is moving and turning at.
  140. Movement = 0,
  141. Turn = 0
  142. }
  143.  
  144. Honk = {
  145. Honking = false,
  146. LastHonk = 0,
  147. ReloadTime = 1
  148. }
  149.  
  150. Jump = {
  151. Jumping = false,
  152. LastJump = 0,
  153. ReloadTime = 1.9,
  154. JumpForce = 50
  155. }
  156.  
  157. ToolEquipped = false
  158.  
  159. ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  160. ServerControl.Name = "ServerControl"
  161. ServerControl.Parent = Tool
  162.  
  163. ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  164. ClientControl.Name = "ClientControl"
  165. ClientControl.Parent = Tool
  166.  
  167. Tool.Enabled = true
  168.  
  169. function RayCast(Position, Direction, MaxDistance, IgnoreList)
  170. local IgnoreList = ((type(IgnoreList) == "table" and IgnoreList) or {IgnoreList})
  171. return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
  172. end
  173.  
  174. function GetAllConnectedParts(Object)
  175. local Parts = {}
  176. local function GetConnectedParts(Object)
  177. for i, v in pairs(Object:GetConnectedParts()) do
  178. local Ignore = false
  179. for ii, vv in pairs(Parts) do
  180. if v == vv then
  181. Ignore = true
  182. end
  183. end
  184. if not Ignore then
  185. table.insert(Parts, v)
  186. GetConnectedParts(v)
  187. end
  188. end
  189. end
  190. GetConnectedParts(Object)
  191. return Parts
  192. end
  193.  
  194. function EnableFirstPersonView()
  195. if not CheckIfAlive() or not ToolEquipped then
  196. return
  197. end
  198. local Limbs = {"Left Arm", "Right Arm"}
  199. for i, v in pairs(Limbs) do
  200. local Limb = Character:FindFirstChild(v)
  201. if Limb:IsA("BasePart") then
  202. Spawn(function()
  203. InvokeClient("SetLocalTransparencyModifier", {Object = Limb, Transparency = 0, AutoUpdate = false})
  204. end)
  205. end
  206. end
  207. end
  208.  
  209. function ThrustUpdater()
  210.  
  211. for i, v in pairs(CurrentSpeed) do
  212. CurrentSpeed[i] = 0
  213. end
  214. for i, v in pairs(Controls) do
  215. Controls[i].Mode = false
  216. end
  217.  
  218. 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
  219.  
  220. RotationForce.angularvelocity = Vector3.new(0, CurrentSpeed.Turn, 0)
  221. if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
  222. CurrentSpeed.Turn = (CurrentSpeed.Turn - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
  223. else
  224. CurrentSpeed.Turn = 0
  225. end
  226.  
  227. if not Controls.Forward.Mode or Controls.Backward.Mode then --Slow down if not controlling.
  228. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.99)
  229. end
  230.  
  231. local MySpeed = Vector3.new(Body.Velocity.X, 0, Body.Velocity.Z).magnitude
  232. local VelocityDifference = math.abs((MySpeed - (ThrustForce.velocity.magnitude)))
  233. if MySpeed > 3 and ThrustForce.velocity.magnitude > 3 and VelocityDifference > (0.7 * ThrustForce.velocity.magnitude) then
  234. CurrentSpeed.Movement = (CurrentSpeed.Movement * 0.9)
  235. end
  236.  
  237. if Controls.Forward.Mode then --Handle acceleration
  238. CurrentSpeed.Movement = math.min(MaxSpeed.Movement.Max, (CurrentSpeed.Movement + (MaxSpeed.Acceleration * Rate)))
  239. end
  240. if Controls.Backward.Mode then --Handle deceleration, if speed is more than 0, decrease quicker.
  241. CurrentSpeed.Movement = math.max(-MaxSpeed.Movement.Min, (CurrentSpeed.Movement - (MaxSpeed.Deceleration * ((CurrentSpeed.Movement > 0 and 2.8) or 1) * Rate)))
  242. end
  243.  
  244. if Controls.Left.Mode then --Handle left turn speed
  245. CurrentSpeed.Turn = math.min(Speed.TurnSpeed.Speed.Max, (CurrentSpeed.Turn + (Speed.TurnSpeed.TurnAlpha)))
  246. end
  247. if Controls.Right.Mode then --Handle right turn speed
  248. CurrentSpeed.Turn = math.max(-Speed.TurnSpeed.Speed.Min, (CurrentSpeed.Turn - (Speed.TurnSpeed.TurnAlpha)))
  249. end
  250.  
  251. local Direction = Torso.CFrame.lookVector
  252. Direction = Vector3.new(Direction.x, 0, Direction.z).unit
  253.  
  254. local Velocity = (Direction * CurrentSpeed.Movement) --The thrust force which you move.
  255. ThrustForce.velocity = Vector3.new(Velocity.X, ThrustForce.velocity.Y, Velocity.Z)
  256.  
  257. local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 4) --Amount your character leans over.
  258. local XZAngle = math.atan2(Torso.CFrame.lookVector.z, 0, Torso.CFrame.lookVector.x) --Handle rotation
  259. TurnGyro.cframe = CFrame.Angles((LeanAmount * Direction.x), 0, (LeanAmount * Direction.z))
  260.  
  261. --Wheel animation
  262. local DesiredAngle = (999999999 * (-CurrentSpeed.Movement / math.abs(CurrentSpeed.Movement)))
  263. local MaxVelocity = (CurrentSpeed.Movement / 250)
  264. for i, v in pairs({FrontMotor, BackMotor}) do
  265. if v and v.Parent then
  266. v.DesiredAngle = DesiredAngle
  267. v.MaxVelocity = MaxVelocity
  268. end
  269. end
  270.  
  271. --Smoke exhaust from vehicle running.
  272. for i, v in pairs(ExhaustSmoke) do
  273. if v and v.Parent then
  274. v.Opacity = ((math.min(math.abs(CurrentSpeed.Movement), 10) / 10) * 0.5)
  275. end
  276. end
  277.  
  278. --Engine running sound which pitch changes while in motion.
  279. Sounds.Engine.Pitch = (1 + (math.abs(CurrentSpeed.Movement / MaxSpeed.Movement.Max) * 1))
  280.  
  281. if (tick() - CycleTick) >= CycleTime then
  282. CycleTick = tick()
  283. CurrentColor = (CurrentColor + 1)
  284. CurrentColor = ((CurrentColor > #Colors and 1) or CurrentColor)
  285. local ColorTable = Colors[CurrentColor]
  286. ColorValue.Value = ColorTable.Color.Color
  287. local Parts = {Body}
  288. for i, v in pairs(Body:GetChildren()) do
  289. if v:IsA("BasePart") then
  290. table.insert(Parts, v)
  291. end
  292. end
  293. for i, v in pairs(Parts) do
  294. if v ~= Body then
  295. v.BrickColor = ColorTable.Color
  296. end
  297. for ii, vv in pairs(v:GetChildren()) do
  298. if vv:IsA("FileMesh") then
  299. vv.TextureId = (BaseUrl .. ColorTable.Texture)
  300. elseif vv:IsA("Light") then
  301. vv.Color = ColorTable.Color.Color
  302. elseif vv:IsA("BasePart") then
  303. end
  304. end
  305. end
  306. end
  307.  
  308. wait(Rate)
  309.  
  310. end
  311. end
  312.  
  313. function SpawnVehicle()
  314.  
  315. Handle.Transparency = 1
  316.  
  317. Spawn(function()
  318. InvokeClient("PlaySound", Sounds.Engine)
  319. InvokeClient("PlayAnimation", Animations.Hold)
  320. end)
  321.  
  322. Humanoid.PlatformStand = true
  323.  
  324. CurrentColor = math.random(1, #Colors)
  325. ColorValue.Value = Colors[CurrentColor].Color.Color
  326.  
  327. local VehicleData = Assets.CreateVehicle()
  328. Body = VehicleData.Vehicle
  329. local ParticleTable = VehicleData.Tables
  330.  
  331. FrontMotor = Body.FrontMotor
  332. BackMotor = Body.BackMotor
  333.  
  334. ExhaustSmoke = ParticleTable.ExhaustSmoke
  335. Lights = ParticleTable.Lights
  336. Sparkles = ParticleTable.Sparkles
  337.  
  338. if SpeedBoost.Active then
  339. for i, v in pairs(Sparkles) do
  340. if v and v.Parent then
  341. v.Enabled = true
  342. end
  343. end
  344. end
  345.  
  346. local TorsoWeld = Instance.new("Weld")
  347. TorsoWeld.C0 = PoseOffset
  348. TorsoWeld.Part0 = Torso
  349. TorsoWeld.Part1 = Body
  350. TorsoWeld.Parent = Body
  351.  
  352. Body.CanCollide = true
  353.  
  354. RotationForce = Instance.new("BodyAngularVelocity")
  355. RotationForce.maxTorque = Vector3.new(0, math.huge, 0)
  356. RotationForce.angularvelocity = Vector3.new(0, 0, 0)
  357. RotationForce.Parent = Torso
  358.  
  359. ThrustForce = Instance.new("BodyVelocity")
  360. ThrustForce.maxForce = Vector3.new(math.huge, 0, math.huge)
  361. ThrustForce.velocity = Vector3.new(0, 0, 0)
  362. ThrustForce.P = 100
  363. ThrustForce.Parent = Torso
  364.  
  365. TurnGyro = Instance.new("BodyGyro")
  366. TurnGyro.maxTorque = Vector3.new(5000, 0, 5000)
  367. TurnGyro.P = 300
  368. TurnGyro.D = 100
  369. TurnGyro.Parent = Torso
  370.  
  371. Body.Parent = Tool
  372.  
  373. local RayHit, RayPos, RayNormal = RayCast(Torso.Position, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character})
  374. if RayHit then
  375. Torso.CFrame = Torso.CFrame + Vector3.new(0, ((Character:GetModelSize().Y / 2) + 1.5), 0)
  376. end
  377.  
  378. Spawn(ThrustUpdater)
  379.  
  380. end
  381.  
  382. function FreezePlayer()
  383. if CheckIfAlive() then
  384. local FreezePart = BasePart:Clone()
  385. FreezePart.Name = "FreezePart"
  386. FreezePart.Transparency = 1
  387. FreezePart.Anchored = true
  388. FreezePart.CanCollide = false
  389. local FreezeWeld = Instance.new("Weld")
  390. FreezeWeld.Part0 = Torso
  391. FreezeWeld.Part1 = FreezePart
  392. FreezeWeld.Parent = FreezePart
  393. Debris:AddItem(FreezePart, 0.125)
  394. FreezePart.Parent = Character
  395. Torso.Velocity = Vector3.new(0, -25, 0)
  396. Torso.RotVelocity = Vector3.new(0, 0, 0)
  397. end
  398. end
  399.  
  400. function CleanUp()
  401. Handle.Velocity = Vector3.new(0, 0, 0)
  402. Handle.RotVelocity = Vector3.new(0, 0, 0)
  403. for i, v in pairs({}) do
  404. if v then
  405. v:disconnect()
  406. end
  407. end
  408. for i, v in pairs({Body, RotationForce, ThrustForce, TurnGyro}) do
  409. if v and v.Parent then
  410. v:Destroy()
  411. end
  412. end
  413. for i, v in pairs(Tool:GetChildren()) do
  414. if v:IsA("BasePart") and v ~= Handle then
  415. v:Destroy()
  416. end
  417. end
  418. end
  419.  
  420. function CheckIfAlive()
  421. 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)
  422. end
  423.  
  424. function Equipped(Mouse)
  425. Character = Tool.Parent
  426. Player = Players:GetPlayerFromCharacter(Character)
  427. Humanoid = Character:FindFirstChild("Humanoid")
  428. Torso = Character:FindFirstChild("Torso")
  429. if not CheckIfAlive() then
  430. return
  431. end
  432. for i, v in pairs(Colors) do
  433. Spawn(function()
  434. InvokeClient("Preload", (BaseUrl .. v.Texture))
  435. end)
  436. end
  437. Spawn(CleanUp)
  438. Spawn(EnableFirstPersonView)
  439. Spawn(SpawnVehicle)
  440. ToolEquipped = true
  441. end
  442.  
  443. function Unequipped()
  444. Spawn(CleanUp)
  445. Spawn(FreezePlayer)
  446. for i, v in pairs(Sounds) do
  447. v:Stop()
  448. Spawn(function()
  449. InvokeClient("StopSound", v)
  450. end)
  451. end
  452. if CheckIfAlive() then
  453. Humanoid.PlatformStand = false
  454. end
  455. Handle.Transparency = 0
  456. ToolEquipped = false
  457. end
  458.  
  459. function OnServerInvoke(player, mode, value)
  460. if player == Player and ToolEquipped and value and CheckIfAlive() then
  461. if mode == "KeyPress" then
  462. local Down = value.Down
  463. local Key = value.Key
  464. local ByteKey = string.byte(Key)
  465. for i, v in pairs(Controls) do
  466. if Key == v.Key or ByteKey == v.ByteKey then
  467. Controls[i].Mode = Down
  468. end
  469. end
  470. if Key == " " and Down then --Jump controller
  471. if math.abs(tick() - Jump.LastJump) > Jump.ReloadTime and not Jump.Jumping and ThrustForce and ThrustForce.Parent then
  472. Jump.Jumping = true
  473. local Parts = GetAllConnectedParts(Body)
  474. local Mass = 0
  475. for i, v in pairs(Parts) do
  476. Mass = (Mass + v:GetMass())
  477. end
  478. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, ((Mass * Gravity) * 100), ThrustForce.maxForce.Z)
  479. ThrustForce.velocity = (Vector3.new(0, 1, 0) * Jump.JumpForce) + Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  480. wait(0.1)
  481. ThrustForce.maxForce = Vector3.new(ThrustForce.maxForce.X, 0, ThrustForce.maxForce.Z)
  482. ThrustForce.velocity = Vector3.new(ThrustForce.velocity.X, 0, ThrustForce.velocity.Z)
  483. Jump.LastJump = tick()
  484. Jump.Jumping = false
  485. end
  486. elseif Key == "x" and Down then --Toggle light(s) on/off.
  487. for i, v in pairs(Lights) do
  488. if v and v.Parent then
  489. v.Enabled = not v.Enabled
  490. end
  491. end
  492. elseif Key == "h" and Down then --Play honk sound.
  493. local Sound = Sounds.Honk
  494. if (tick() - Honk.LastHonk) >= (Sound.TimeLength + Honk.ReloadTime) and not Honk.Honking then
  495. Honk.Honking = true
  496. local TempSound = Sound:Clone()
  497. Debris:AddItem(TempSound, Sound.TimeLength)
  498. TempSound.Parent = Body
  499. TempSound:Play()
  500. Honk.LastHonk = tick()
  501. Honk.Honking = false
  502. end
  503. elseif Key == "q" and Down then --Activate special.
  504. if not Special.Allowed or not Special.Enabled or Special.Active then
  505. return
  506. end
  507. Special.Enabled = false
  508. Special.Active = true
  509. wait(Special.Duration)
  510. Special.Active = false
  511. wait(Special.ReloadTime)
  512. Special.Enabled = true
  513. elseif ByteKey == 48 and Down then --Activate speed boost.
  514. if not SpeedBoost.Allowed or not SpeedBoost.Enabled or SpeedBoost.Active then
  515. return
  516. end
  517. SpeedBoost.Enabled = false
  518. SpeedBoost.Active = true
  519. for i, v in pairs(Sparkles) do
  520. if v and v.Parent then
  521. v.Enabled = true
  522. end
  523. end
  524. MaxSpeed.Acceleration = Speed.Acceleration.Boost
  525. MaxSpeed.Deceleration = Speed.Deceleration.Boost
  526. MaxSpeed.Movement = Speed.MovementSpeed.Boost
  527. wait(SpeedBoost.Duration)
  528. MaxSpeed.Acceleration = Speed.Acceleration.Normal
  529. MaxSpeed.Deceleration = Speed.Deceleration.Normal
  530. MaxSpeed.Movement = Speed.MovementSpeed.Normal
  531. for i, v in pairs(Sparkles) do
  532. if v and v.Parent then
  533. v.Enabled = false
  534. end
  535. end
  536. SpeedBoost.Active = false
  537. wait(SpeedBoost.ReloadTime)
  538. SpeedBoost.Enabled = true
  539. end
  540. end
  541. end
  542. end
  543.  
  544. function InvokeClient(Mode, Value)
  545. local ClientReturn = nil
  546. pcall(function()
  547. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  548. end)
  549. return ClientReturn
  550. end
  551.  
  552. Spawn(CleanUp)
  553.  
  554. ServerControl.OnServerInvoke = OnServerInvoke
  555. Tool.Equipped:connect(Equipped)
  556. Tool.Unequipped:connect(Unequipped)
  557. end))
  558. Script2.Name = "TrailScript"
  559. Script2.Parent = Tool0
  560. table.insert(cors,sandbox(Script2,function()
  561. --Made by Luckymaxer
  562.  
  563. Tool = script.Parent
  564. Handle = Tool:WaitForChild("Handle")
  565.  
  566. Debris = game:GetService("Debris")
  567.  
  568. CurrentColor = Tool:WaitForChild("CurrentColor")
  569.  
  570. BasePart = Instance.new("Part")
  571. BasePart.Shape = Enum.PartType.Block
  572. BasePart.Material = Enum.Material.Plastic
  573. BasePart.TopSurface = Enum.SurfaceType.Smooth
  574. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  575. BasePart.FormFactor = Enum.FormFactor.Custom
  576. BasePart.Anchored = false
  577. BasePart.CanCollide = true
  578. BasePart.Locked = true
  579.  
  580. BaseTrailPart = BasePart:Clone()
  581. BaseTrailPart.Name = "LaserTrail"
  582. BaseTrailPart.Transparency = 0.2
  583. BaseTrailPart.Size = Vector3.new(0.2, 5, 3)
  584. BaseTrailPart.Material = Enum.Material.SmoothPlastic
  585. BaseTrailPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  586. BaseTrailPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  587. BaseTrailPart.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  588. BaseTrailPart.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  589. BaseTrailPart.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  590. BaseTrailPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  591. BaseTrailPart.Anchored = true
  592. BaseTrailPart.CanCollide = false
  593. TrailLight = Instance.new("PointLight")
  594. TrailLight.Name = "Light"
  595. TrailLight.Brightness = 10
  596. TrailLight.Range = 8
  597. TrailLight.Shadows = false
  598. TrailLight.Enabled = true
  599. TrailLight.Parent = BaseTrailPart
  600.  
  601. Rate = (1 / 60)
  602.  
  603. function StartTrail(Source, Parent)
  604.  
  605. local TrailParts = {}
  606.  
  607. local SourceAlive = true
  608.  
  609. local NumberOfParts = 60
  610. local LastPoint = (Source.CFrame * CFrame.new(0, 0, 4)).p
  611.  
  612. Source.Changed:connect(function(Property)
  613. if Property == "Parent" and not Source.Parent then
  614. SourceAlive = false
  615. end
  616. end)
  617.  
  618. while SourceAlive do
  619. local CurrentPoint = (Source.CFrame * CFrame.new(0, 0, 4)).p
  620. if Source.Velocity.magnitude > 20 then
  621. local TrailPart = BaseTrailPart:Clone()
  622. TrailPart.BrickColor = BrickColor.new(CurrentColor.Value)
  623. TrailPart.Light.Color = CurrentColor.Value
  624. TrailPart.Size = Vector3.new(TrailPart.Size.X, TrailPart.Size.Y, (CurrentPoint - LastPoint).magnitude)
  625. table.insert(TrailParts, TrailPart)
  626. TrailPart.Parent = Parent
  627. TrailPart.CFrame = CFrame.new(((CurrentPoint + LastPoint) * 0.5), LastPoint)
  628. if #TrailParts > NumberOfParts then
  629. local TrailPart = TrailParts[1]
  630. if TrailPart and TrailPart.Parent then
  631. TrailPart:Destroy()
  632. end
  633. table.remove(TrailParts, 1)
  634. end
  635. else
  636. local TrailPart = TrailParts[1]
  637. if TrailPart and TrailPart.Parent then
  638. TrailPart:Destroy()
  639. end
  640. table.remove(TrailParts, 1)
  641. end
  642. LastPoint = CurrentPoint
  643. wait(Rate)
  644. end
  645.  
  646. for i, v in pairs(TrailParts) do
  647. if v and v.Parent then
  648. v:Destroy()
  649. end
  650. end
  651.  
  652. end
  653.  
  654. Tool.ChildAdded:connect(function(Child)
  655. if Child.Name == "Body" then
  656. Spawn(function()
  657. StartTrail(Child, Tool)
  658. end)
  659. end
  660. end)
  661. end))
  662. LocalScript3.Name = "MouseIcon"
  663. LocalScript3.Parent = Tool0
  664. table.insert(cors,sandbox(LocalScript3,function()
  665. --Made by Luckymaxer
  666.  
  667. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  668. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  669.  
  670. Tool = script.Parent
  671.  
  672. Mouse = nil
  673.  
  674. function UpdateIcon()
  675. if Mouse then
  676. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  677. end
  678. end
  679.  
  680. function OnEquipped(ToolMouse)
  681. Mouse = ToolMouse
  682. UpdateIcon()
  683. end
  684.  
  685. function OnChanged(Property)
  686. if Property == "Enabled" then
  687. UpdateIcon()
  688. end
  689. end
  690.  
  691. Tool.Equipped:connect(OnEquipped)
  692. Tool.Changed:connect(OnChanged)
  693. end))
  694. Animation4.Name = "Hold"
  695. Animation4.Parent = Tool0
  696. Animation4.AnimationId = "http://www.roblox.com/asset/?id=214738896"
  697. Color3Value5.Name = "CurrentColor"
  698. Color3Value5.Parent = Tool0
  699. Color3Value5.Value = Color3.new(0.666667, 0, 0.666667)
  700. LocalScript6.Parent = Tool0
  701. table.insert(cors,sandbox(LocalScript6,function()
  702. --Made by Luckymaxer
  703.  
  704. Tool = script.Parent
  705. Handle = Tool:WaitForChild("Handle")
  706.  
  707. Players = game:GetService("Players")
  708. RunService = game:GetService("RunService")
  709. ContentProvider = game:GetService("ContentProvider")
  710.  
  711. Camera = game:GetService("Workspace").CurrentCamera
  712.  
  713. Animations = {}
  714. LocalObjects = {}
  715.  
  716. ServerControl = Tool:WaitForChild("ServerControl")
  717. ClientControl = Tool:WaitForChild("ClientControl")
  718.  
  719. ToolEquipped = false
  720.  
  721. function SetAnimation(mode, value)
  722. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  723. for i, v in pairs(Animations) do
  724. if v.Animation == value.Animation then
  725. v.AnimationTrack:Stop()
  726. table.remove(Animations, i)
  727. end
  728. end
  729. local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
  730. table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
  731. AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
  732. elseif mode == "StopAnimation" and value then
  733. for i, v in pairs(Animations) do
  734. if v.Animation == value.Animation then
  735. v.AnimationTrack:Stop()
  736. table.remove(Animations, i)
  737. end
  738. end
  739. end
  740. end
  741.  
  742. function DisableJump(Boolean)
  743. if PreventJump then
  744. PreventJump:disconnect()
  745. end
  746. if Boolean then
  747. PreventJump = Humanoid.Changed:connect(function(Property)
  748. if Property == "Jump" then
  749. Humanoid.Jump = false
  750. end
  751. end)
  752. end
  753. end
  754.  
  755. function CheckIfAlive()
  756. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
  757. end
  758.  
  759. function Equipped(Mouse)
  760. Character = Tool.Parent
  761. Player = Players:GetPlayerFromCharacter(Character)
  762. Humanoid = Character:FindFirstChild("Humanoid")
  763. ToolEquipped = true
  764. if not CheckIfAlive() then
  765. return
  766. end
  767. PlayerMouse = Player:GetMouse()
  768. Mouse.Button1Down:connect(function()
  769. InvokeServer("MouseClick", {Down = true})
  770. end)
  771. Mouse.Button1Up:connect(function()
  772. InvokeServer("MouseClick", {Down = false})
  773. end)
  774. Mouse.KeyDown:connect(function(Key)
  775. InvokeServer("KeyPress", {Key = Key, Down = true})
  776. end)
  777. Mouse.KeyUp:connect(function(Key)
  778. InvokeServer("KeyPress", {Key = Key, Down = false})
  779. end)
  780. Mouse.Move:connect(function()
  781. InvokeServer("MouseMove", {Position = Mouse.Hit.p, Target = Mouse.Target})
  782. end)
  783. Humanoid:ChangeState(Enum.HumanoidStateType.None)
  784. end
  785.  
  786. function Unequipped()
  787. ToolEquipped = false
  788. LocalObjects = {}
  789. for i, v in pairs(Animations) do
  790. if v and v.AnimationTrack then
  791. v.AnimationTrack:Stop()
  792. end
  793. end
  794. for i, v in pairs({PreventJump, ObjectLocalTransparencyModifier}) do
  795. if v then
  796. v:disconnect()
  797. end
  798. end
  799. Humanoid:ChangeState(Enum.HumanoidStateType.Freefall) --Prevent the ability to fly by constantly equipping and unequipping the tool.
  800. Animations = {}
  801. end
  802.  
  803. function InvokeServer(mode, value)
  804. pcall(function()
  805. local ServerReturn = ServerControl:InvokeServer(mode, value)
  806. return ServerReturn
  807. end)
  808. end
  809.  
  810. function OnClientInvoke(mode, value)
  811. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  812. SetAnimation("PlayAnimation", value)
  813. elseif mode == "StopAnimation" and value then
  814. SetAnimation("StopAnimation", value)
  815. elseif mode == "PlaySound" and value then
  816. value:Play()
  817. elseif mode == "StopSound" and value then
  818. value:Stop()
  819. elseif mode == "MousePosition" then
  820. return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
  821. elseif mode == "DisableJump" then
  822. DisableJump(value)
  823. elseif mode == "Preload" and value then
  824. ContentProvider:Preload(value)
  825. elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
  826. pcall(function()
  827. local ObjectFound = false
  828. for i, v in pairs(LocalObjects) do
  829. if v == value then
  830. ObjectFound = true
  831. end
  832. end
  833. if not ObjectFound then
  834. table.insert(LocalObjects, value)
  835. if ObjectLocalTransparencyModifier then
  836. ObjectLocalTransparencyModifier:disconnect()
  837. end
  838. ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
  839. for i, v in pairs(LocalObjects) do
  840. if v.Object and v.Object.Parent then
  841. local CurrentTransparency = v.Object.LocalTransparencyModifier
  842. if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
  843. v.Object.LocalTransparencyModifier = v.Transparency
  844. end
  845. else
  846. table.remove(LocalObjects, i)
  847. end
  848. end
  849. end)
  850. end
  851. end)
  852. end
  853. end
  854.  
  855. ClientControl.OnClientInvoke = OnClientInvoke
  856. Tool.Equipped:connect(Equipped)
  857. Tool.Unequipped:connect(Unequipped)
  858. end))
  859. Part7.Name = "Handle"
  860. Part7.Parent = Tool0
  861. Part7.Locked = true
  862. Part7.Elasticity = 0
  863. Part7.FormFactor = Enum.FormFactor.Custom
  864. Part7.Friction = 0
  865. Part7.Size = Vector3.new(0.200000003, 3.625, 9)
  866. Part7.CFrame = CFrame.new(-24, 1.8125, -7, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  867. Part7.BottomSurface = Enum.SurfaceType.Smooth
  868. Part7.TopSurface = Enum.SurfaceType.Smooth
  869. Part7.Position = Vector3.new(-24, 1.8125, -7)
  870. SpecialMesh8.Parent = Part7
  871. SpecialMesh8.MeshId = "http://www.roblox.com/asset/?id=204410623"
  872. SpecialMesh8.Scale = Vector3.new(1.25, 1.25, 1.25)
  873. SpecialMesh8.TextureId = "rbxassetid://256465742"
  874. SpecialMesh8.MeshType = Enum.MeshType.FileMesh
  875. SpecialMesh8.Scale = Vector3.new(1.25, 1.25, 1.25)
  876. Sound9.Name = "Running"
  877. Sound9.Parent = Part7
  878. Sound9.Pitch = 1.7471721172333
  879. Sound9.SoundId = "http://www.roblox.com/asset/?id=130091914"
  880. Sound9.Looped = true
  881. Sound10.Name = "Honk"
  882. Sound10.Parent = Part7
  883. for i,v in pairs(mas:GetChildren()) do
  884. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  885. pcall(function() v:MakeJoints() end)
  886. end
  887. mas:Destroy()
  888. for i,v in pairs(cors) do
  889. spawn(function()
  890. pcall(v)
  891. end)
  892. end
Add Comment
Please, Sign In to add comment