Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PhysicsService = game:GetService("PhysicsService")
- local pards = {}
- local pards2 = {}
- local car = "car"
- local wheels = "wheels"
- pcall(function()
- -- Create two collision groups
- PhysicsService:CreateCollisionGroup(car)
- PhysicsService:CreateCollisionGroup(wheels)
- PhysicsService:SetPartCollisionGroup(pards, car)
- PhysicsService:SetPartCollisionGroup(pards2, wheels)
- PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
- end)
- function suspension(what,cf,mot,dir)
- local a = Instance.new("Part", script)
- local a2 = Instance.new("Part", script)
- local a3 = Instance.new("Part", script)
- local a4 = Instance.new("Part", script)
- a4.Locked = true
- a.Locked = true
- a2.Locked = true
- a3.Locked = true
- PhysicsService:SetPartCollisionGroup(a, wheels)
- PhysicsService:SetPartCollisionGroup(a4, wheels)
- PhysicsService:SetPartCollisionGroup(a2, wheels)
- PhysicsService:SetPartCollisionGroup(a3, wheels)
- a2.Name = "the"
- a4.Name = "the"
- a3.Name = "the"
- a.Name = "the"
- local density = 3
- local friction = 3
- local elasticity = 0
- local frictionWeight = 10000
- local elasticityWeight = 100000
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- a2.CustomPhysicalProperties = physProperties
- a.Size = Vector3.new(1,1,1)
- a2.Size = Vector3.new(1.375,3.125,3.125)
- a2.Shape = "Cylinder"
- a2.Material = "Plastic"
- a3.Size = Vector3.new(0.125,1.75,1.75)
- a3.Shape = "Cylinder"
- a3.CanCollide = false
- a3.Material = "SmoothPlastic"
- a3.Color = Color3.fromRGB(163,162,165)
- a2.Color = Color3.fromRGB(27,42,53)
- local weld = Instance.new("Weld",a2)
- weld.Part0 = a3
- weld.Part1 = a2
- a.CFrame = what.CFrame * cf:Inverse()
- a.Anchored = true
- a2.CFrame = what.CFrame * cf:Inverse() * CFrame.new(1,0,0)
- a2.Anchored = true
- a4.CFrame = what.CFrame * cf:Inverse() * CFrame.new(1,0,0)
- a4.Anchored = true
- a.Transparency = 1
- a4.Transparency = 1
- a.CanCollide = false
- a4.CanCollide = false
- local mesh = Instance.new("SpecialMesh",a2)
- mesh.Scale = Vector3.new(0.825,0.725,0.725)
- mesh.MeshId = "rbxassetid://432499736"
- local mesh2 = Instance.new("SpecialMesh",a3)
- mesh2.Scale = Vector3.new(0.675,0.675,0.675)
- mesh2.MeshId = "rbxassetid://432499736"
- local at0 = Instance.new("Attachment" , a)
- if not mot then
- at0.CFrame = CFrame.new(0.5,-1,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))
- else
- at0.CFrame = CFrame.new(2,-1,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))
- end
- local at1 = Instance.new("Attachment" , a4)
- at1.CFrame = CFrame.Angles(0,0,math.rad(180))
- local att3 = Instance.new("Attachment" , a2)
- local at2 = Instance.new("Attachment" , a)
- at2.CFrame = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(1,0,0)
- local att4 = Instance.new("Attachment" , a4)
- att4.CFrame = CFrame.Angles(0,0,0) * CFrame.Angles(math.rad(180),math.rad(90),0)
- local att5 = Instance.new("Attachment" , what)
- att5.CFrame = CFrame.Angles(0,0,0) * CFrame.Angles(math.rad(180),math.rad(90),0)
- local pe = Instance.new("ParticleEmitter", at0)
- pe.LightEmission = 0
- pe.LightInfluence = 1
- pe.EmissionDirection = dir
- pe.VelocityInheritance = 0.35
- pe.Orientation = Enum.ParticleOrientation.FacingCamera
- pe.Size = NumberSequence.new(0.85,1.25)
- pe.Texture = "rbxassetid://34098552"
- pe.Transparency = NumberSequence.new(0.4,0.6)
- pe.Lifetime = NumberRange.new(1,1.25)
- pe.Rate = 200
- pe.Rotation = NumberRange.new(math.random(-360,360))
- pe.RotSpeed = NumberRange.new(10)
- pe.Speed = NumberRange.new(5)
- pe.SpreadAngle = Vector2.new(-15,15)
- pe.Drag = NumberRange.new(1)
- pe.Enabled = false
- coroutine.wrap(function()
- while a3.Parent ~= nil do
- task.wait()
- if a3.Velocity.Magnitude >= 2 then
- pe.Enabled = true
- else
- pe.Enabled = false
- end
- end
- end)()
- local prism = Instance.new("CylindricalConstraint" , a)
- prism.Attachment0 = at0
- prism.InclinationAngle = 90
- prism.Attachment1 = at1
- prism.LimitsEnabled = true
- prism.LowerLimit = -1.5
- prism.UpperLimit = 1.5
- prism.Restitution = 0.3
- prism.AngularLimitsEnabled = true
- prism.LowerAngle = 15
- prism.UpperAngle = -5
- local tor = Instance.new("TorsionSpringConstraint" , what)
- tor.Stiffness = 300000
- tor.Attachment0 = att5
- tor.Attachment1 = att4
- tor.Damping = 10
- tor.Restitution = 0.1
- tor.Visible = true
- tor.MaxAngle = 1
- tor.MaxTorque = math.huge
- local spring = Instance.new("SpringConstraint" , a)
- spring.Attachment0 = att3
- spring.Attachment1 = at2
- spring.Stiffness = 30000
- if not mot then
- spring.FreeLength = (2.2 * 0.5) * 0.5
- else
- spring.FreeLength = 2.2
- end
- spring.Enabled = true
- spring.Damping = 410
- local att0 = Instance.new("Attachment",a4)
- local att1 = Instance.new("Attachment",a2)
- att0.CFrame = CFrame.Angles(0,math.rad(-90),0)
- local ro = Instance.new("HingeConstraint",a4)
- ro.Attachment0 = att0
- ro.Attachment1 = att1
- ro.ActuatorType = "Motor"
- ro.MotorMaxAcceleration = math.huge-1
- ro.MotorMaxTorque = math.huge-1
- wait()
- a2.Anchored = false
- a.Anchored = false
- a4.Anchored = false
- local wel = Instance.new("Weld",what)
- wel.Part0 = a
- wel.Part1 = what
- wel.C0 = cf
- return ro
- end
- part = Instance.new("VehicleSeat",script)
- part.MaxSpeed = 100000
- part.Torque = math.huge
- part.Anchored = true
- part.CFrame = owner.Character.Head.CFrame * CFrame.new(0,-4,-2) * CFrame.Angles(0,math.rad(-90),0)
- part31 = Instance.new("Part",script)
- part31.Anchored = true
- part31.CFrame = owner.Character.Head.CFrame * CFrame.new(0,-2,-2)
- part31.Size = Vector3.new(5,3,7)
- part2 = Instance.new("Part",script)
- part2.Anchored = true
- part2.CFrame = owner.Character.Head.CFrame * CFrame.new(-11.75,-1.5,-2)
- part2.Size = Vector3.new(0.25,2.5,7)
- part3 = Instance.new("Part",script)
- part3.Anchored = true
- part3.CFrame = owner.Character.Head.CFrame * CFrame.new(-11.95,-1.5,-2)
- part3.Size = Vector3.new(0.175,2.25,7)
- part4 = Instance.new("Part",script)
- part4.Anchored = true
- part4.CFrame = owner.Character.Head.CFrame * CFrame.new(-12.15,-2.5,-2)
- part4.Size = Vector3.new(0.75,0.75,7)
- part5 = Instance.new("Part",script)
- part5.Anchored = true
- part5.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.125,-0.85,1.35)
- part5.Size = Vector3.new(9,1.25,0.25)
- part6 = Instance.new("Part",script)
- part6.Anchored = true
- part6.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.125,-0.85,-5.35)
- part6.Size = Vector3.new(9,1.25,0.25)
- part7 = Instance.new("Part",script)
- part7.Anchored = true
- part7.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.25,-2.25,1.35)
- part7.Size = Vector3.new(3,1.75,0.25)
- part8 = Instance.new("Part",script)
- part8.Anchored = true
- part8.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.15,-2.25,0.85) * CFrame.Angles(0,0,math.rad(15))
- part8.Size = Vector3.new(0.25,2,1.35)
- part9 = Instance.new("Part",script)
- part9.Anchored = true
- part9.CFrame = owner.Character.Head.CFrame * CFrame.new(-9.5,-2.0625,0.85) * CFrame.Angles(0,0,math.rad(-15))
- part9.Size = Vector3.new(0.25,1.65,1.35)
- part10 = Instance.new("Part",script)
- part10.Anchored = true
- part10.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.25,0.85)
- part10.Size = Vector3.new(2.85,0.25,1.35)
- part11 = Instance.new("Part",script)
- part11.Anchored = true
- part11.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.85,-0.0625) * CFrame.Angles(math.rad(15),0,0)
- part11.Size = Vector3.new(2.85,1.35,0.25)
- part12 = Instance.new("Part",script)
- part12.Anchored = true
- part12.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.15,-2.25,-4.8625) * CFrame.Angles(0,0,math.rad(15))
- part12.Size = Vector3.new(0.25,2,1.35)
- part13 = Instance.new("Part",script)
- part13.Anchored = true
- part13.CFrame = owner.Character.Head.CFrame * CFrame.new(-9.5,-2.0625,-4.8625) * CFrame.Angles(0,0,math.rad(-15))
- part13.Size = Vector3.new(0.25,1.65,1.35)
- part14 = Instance.new("Part",script)
- part14.Anchored = true
- part14.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.25,-4.8625)
- part14.Size = Vector3.new(2.85,0.25,1.35)
- part15 = Instance.new("Part",script)
- part15.Anchored = true
- part15.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.85,-3.95) * CFrame.Angles(math.rad(-15),0,0)
- part15.Size = Vector3.new(2.85,1.35,0.25)
- part16 = Instance.new("Part",script)
- part16.Anchored = true
- part16.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-2.25,-2)
- part16.Size = Vector3.new(4,0.25,4)
- part17 = Instance.new("Part",script)
- part17.Anchored = true
- part17.CFrame = owner.Character.Head.CFrame * CFrame.new(-10.625,-2.25,-2)
- part17.Size = Vector3.new(2.25,0.25,6.25)
- part18 = Instance.new("Part",script)
- part18.Anchored = true
- part18.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.625,-2.25,-2)
- part18.Size = Vector3.new(2.5,0.25,6.25)
- part19 = Instance.new("Part",script)
- part19.Anchored = true
- part19.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.25,-2.25,-5.35)
- part19.Size = Vector3.new(3,1.75,0.25)
- part20 = Instance.new("Part",script)
- part20.Anchored = true
- part20.CFrame = owner.Character.Head.CFrame * CFrame.new(-3,-1.5,-2)
- part20.Size = Vector3.new(0.25,2.5,6.25)
- part21 = Instance.new("Part",script)
- part21.Anchored = true
- part21.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.65,-0.5,-2)
- part21.Size = Vector3.new(0.25,4.5,4.25)
- part22 = Instance.new("Part",script)
- part22.Anchored = true
- part22.CFrame = owner.Character.Head.CFrame * CFrame.new(-1.425,0.5,0.45) * CFrame.Angles(math.rad(-20),0,0)
- part22.Size = Vector3.new(2.75,2.25,1)
- part23 = Instance.new("Part",script)
- part23.Anchored = true
- part23.CFrame = owner.Character.Head.CFrame * CFrame.new(-1.425,0.5,-4.45) * CFrame.Angles(math.rad(20),0,0)
- part23.Size = Vector3.new(2.75,2.25,1)
- part24 = Instance.new("Part",script)
- part24.Anchored = true
- part24.CFrame = owner.Character.Head.CFrame * CFrame.new(0.75,0.5,-0.65) * CFrame.Angles(0,math.rad(-10),math.rad(40))
- part24.Size = Vector3.new(1,2.25,2.85)
- part25 = Instance.new("Part",script)
- part25.Anchored = true
- part25.CFrame = owner.Character.Head.CFrame * CFrame.new(0.75,0.5,-3.35) * CFrame.Angles(0,math.rad(10),math.rad(40))
- part25.Size = Vector3.new(1,2.25,2.85)
- part26 = Instance.new("Part",script)
- part26.Anchored = true
- part26.CFrame = owner.Character.Head.CFrame * CFrame.new(4,-0.85,-2)
- part26.Size = Vector3.new(4,1,6.5)
- part27 = Instance.new("Part",script)
- part27.Anchored = true
- part27.CFrame = owner.Character.Head.CFrame * CFrame.new(6.25,-1.75,-2)
- part27.Size = Vector3.new(1,2.25,7)
- part28 = Instance.new("Part",script)
- part28.Anchored = true
- part28.CFrame = owner.Character.Head.CFrame * CFrame.new(6.5,-2.75,-2)
- part28.Size = Vector3.new(1,0.75,7.25)
- local mesh = Instance.new("SpecialMesh",part31)
- mesh.Scale = Vector3.new(0.4,0.4,0.4)
- mesh.MeshId = "rbxassetid://3656796538"
- mesh.TextureId = "rbxassetid://3656802356"
- mesh.Offset = Vector3.new(-2.5,1.5,0)
- part.Size = Vector3.new(5.5,2.5,7.75)
- local idle = Instance.new("Sound",part)
- idle.Looped = true
- idle.SoundId = "rbxassetid://520998094"
- idle.Volume = 0
- idle:Play()
- local sound = Instance.new("Sound",part)
- sound.Looped = true
- sound.Volume = 0
- sound.SoundId = "rbxassetid://6851694831"
- local start = Instance.new("Sound",part)
- start.Volume = 2
- start.SoundId = "rbxassetid://9075587875"
- local tweenService = game:GetService("TweenService")
- local timeToFade = 1.5
- local object = start
- local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear)
- local goal = {}
- goal.Volume = 2
- local tween = tweenService:Create(object, tweenInfo, goal)
- sound:Play()
- part32 = Instance.new("Part",script)
- part32.Anchored = true
- part32.CFrame = owner.Character.Head.CFrame * CFrame.new(-8,0.25,0.75)
- part32.Size = Vector3.new(0.455,1.035, 1.035)
- part32.Color = Color3.fromRGB(190, 104, 98)
- part32.Material = "Glass"
- part33 = Instance.new("Part",script)
- part33.Anchored = true
- part33.CFrame = owner.Character.Head.CFrame * CFrame.new(-8,0.25,-4.75)
- part33.Size = Vector3.new(0.455,1.035, 1.035)
- part33.Color = Color3.fromRGB(190, 104, 98)
- part33.Material = "Glass"
- part33.Transparency = 1
- part33.CanCollide = false
- part32.CanCollide = false
- part32.Transparency = 1
- part34 = Instance.new("Part",script)
- part34.Anchored = true
- part34.CFrame = owner.Character.Head.CFrame * CFrame.new(6.85,-1.5,-4.9)
- part34.Size = Vector3.new(0.095,1.135, 0.535)
- part34.Material = "Glass"
- part35 = Instance.new("Part",script)
- part35.Anchored = true
- part35.CFrame = owner.Character.Head.CFrame * CFrame.new(6.85,-1.5,0.9)
- part35.Size = Vector3.new(0.095,1.135, 0.535)
- part35.Material = "Glass"
- local parts = Instance.new("Seat",script)
- parts.Anchored = true
- parts.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.85,-2,0.75)
- parts.Size = Vector3.new(2,1,1)
- parts.Color = Color3.fromRGB(150, 92, 17)
- parts.Material = "Slate"
- parts.Massless = true
- local parts2 = Instance.new("Seat",script)
- parts2.Anchored = true
- parts2.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.85,-2,-4.75) * CFrame.Angles(0,math.rad(180),0)
- parts2.Size = Vector3.new(2,1,1)
- parts2.Color = Color3.fromRGB(150, 92, 17)
- parts2.Material = "Slate"
- parts2.Massless = true
- local hitdb = false
- mod = nil
- local bed = false
- local welds = {}
- prox4 = Instance.new("ProximityPrompt",part)
- prox4.RequiresLineOfSight = false
- prox4.Style = Enum.ProximityPromptStyle.Custom
- prox4.KeyboardKeyCode = Enum.KeyCode.Y
- prox4.Triggered:Connect(function(player)
- if player.Character == mod then
- if not bed then
- bed = true
- local params = OverlapParams.new()
- params.FilterDescendantsInstances = {script:GetDescendants()}
- params.FilterType = Enum.RaycastFilterType.Blacklist
- for _, v in pairs(workspace:GetPartBoundsInBox(part.CFrame * CFrame.new(0,1.5,4), Vector3.new(6,3,10), params)) do
- local weld = Instance.new("WeldConstraint",part)
- weld.Part0 = v
- weld.Part1 = part
- table.insert(welds,weld)
- end
- elseif bed then
- for i,v in pairs(welds) do
- v:Destroy()
- end
- wait()
- welds = {}
- end
- end
- end)
- wait()
- beam1 = Instance.new("Beam")
- beam1.Texture = "rbxassetid://175588117"
- beam1.TextureLength = 1
- beam1.LightEmission = 1
- beam1.CurveSize0 = 0
- beam1.CurveSize1 = 0
- beam1.FaceCamera = true
- beam1.Segments = 2
- beam1.Width0 = 1
- beam1.Width1 = 8
- beam1.Enabled = false
- beam1.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0),NumberSequenceKeypoint.new(1, 1)}
- local bat1 = Instance.new("Attachment",part)
- bat1.WorldCFrame = part34.CFrame
- local bat2 = Instance.new("Attachment",part34)
- bat2.WorldCFrame = part34.CFrame * CFrame.new(24,0,0)
- beam1.Attachment0 = bat1
- beam1.Attachment1 = bat2
- beam1.Parent = part
- local lon = false
- function lights(on)
- if on then
- part33.Color = Color3.fromRGB(190, 104, 98)
- part33.Material = "Neon"
- part32.Color = Color3.fromRGB(190, 104, 98)
- part32.Material = "Neon"
- else
- part33.Color = Color3.fromRGB(190, 104, 98)
- part33.Material = "Glass"
- part32.Color = Color3.fromRGB(190, 104, 98)
- part32.Material = "Glass"
- end
- end
- wait()
- beam2 = Instance.new("Beam",part)
- beam2.Texture = "rbxassetid://175588117"
- beam2.TextureLength = 1
- beam2.LightEmission = 1
- beam2.CurveSize0 = 0
- beam2.CurveSize1 = 0
- beam2.FaceCamera = true
- beam2.Segments = 2
- beam2.Width0 = 1
- beam2.Width1 = 8
- beam2.Enabled = false
- beam2.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0),NumberSequenceKeypoint.new(1, 1)}
- local bat3 = Instance.new("Attachment",part)
- bat3.WorldCFrame = part35.CFrame
- local bat4 = Instance.new("Attachment",part35)
- bat4.WorldCFrame = part35.CFrame * CFrame.new(24,0,0)
- beam2.Attachment0 = bat3
- beam2.Attachment1 = bat4
- lat = Instance.new("Attachment",part)
- lat.CFrame = CFrame.new(0,0,-6)
- light = Instance.new("SpotLight",lat)
- light.Enabled = false
- light.Range = 24
- light.Face = "Front"
- light.Color = Color3.fromRGB(255,255,255)
- light.Brightness = 3
- light.Angle = 85
- function headlights()
- beam1.Enabled = not beam1.Enabled
- beam2.Enabled = not beam2.Enabled
- light.Enabled = not light.Enabled
- if not lon then
- lon = true
- part34.Color = Color3.fromRGB(232, 232, 232)
- part34.Material = "Neon"
- part35.Color = Color3.fromRGB(232, 232, 232)
- part35.Material = "Neon"
- else
- lon = false
- part35.Color = Color3.fromRGB(248, 248, 248)
- part34.Material = "Glass"
- part35.Color = Color3.fromRGB(248, 248, 248)
- part35.Material = "Glass"
- end
- end
- part29 = Instance.new("Part",part)
- part29.CanCollide = false
- part29.Transparency = 1
- part30 = Instance.new("Part",part)
- part30.CanCollide = false
- part30.Transparency = 1
- local ats = Instance.new("Attachment",part)
- ats.CFrame = CFrame.new(3,0,-4.325) * CFrame.Angles(0,math.rad(90),math.rad(90))
- local ats2 = Instance.new("Attachment",part29)
- ats2.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,math.rad(90),math.rad(90))
- part29.CFrame = part.CFrame * ats.CFrame
- steer = Instance.new("HingeConstraint")
- steer.Parent = part
- steer.ActuatorType = "Servo"
- steer.TargetAngle = 0
- steer.ServoMaxTorque = 10000000000000000
- steer.AngularSpeed = 100000000000000
- steer.Attachment0 = ats
- steer.Attachment1 = ats2
- part30 = Instance.new("Part",part)
- part30.CanCollide = false
- local off = true
- part30.Transparency = 1
- owner.Character.Head.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,2)
- local ats3 = Instance.new("Attachment",part)
- ats3.CFrame = CFrame.new(-3,0,-4.325) * CFrame.Angles(0,math.rad(90),math.rad(90))
- local ats4 = Instance.new("Attachment",part30)
- ats4.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,math.rad(90),math.rad(90))
- part30.CFrame = part.CFrame * ats3.CFrame
- steer2 = Instance.new("HingeConstraint")
- steer2.Parent = part
- steer2.ActuatorType = "Servo"
- steer2.TargetAngle = 0
- steer2.ServoMaxTorque = 10000000000000000
- steer2.AngularSpeed = 100000000000000
- steer2.Attachment0 = ats3
- steer2.Attachment1 = ats4
- for i,v in pairs(script:GetChildren()) do
- if v ~= part then
- local wel = Instance.new("WeldConstraint",part)
- wel.Part0 = v
- wel.Part1 = part
- v.Anchored = false
- v.Transparency = 1
- PhysicsService:SetPartCollisionGroup(v, car)
- v.Locked = true
- end
- end
- wait()
- part.Transparency = 1
- part.Locked = true
- part31.Material = "Plastic"
- part.CanCollide = false
- part31.Transparency = 0
- parts.Transparency = 0
- parts2.Transparency = 0
- part34.Transparency = 0
- part35.Transparency = 0
- PhysicsService:SetPartCollisionGroup(part, car)
- local mot1 = suspension(part29,CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(0),0),false,"Back")
- local mot2 = suspension(part31,CFrame.new(-1.5,2.5,-7.85) * CFrame.Angles(0,math.rad(90),0),true,"Back")
- local mot3 = suspension(part30,CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(180),0),false,"Front")
- local mot4 = suspension(part31,CFrame.new(-1.5,2.5,7.85) * CFrame.Angles(0,math.rad(270),0),true,"Front")
- mot1.AngularVelocity = 0
- mot2.AngularVelocity = 0
- mot3.AngularVelocity = 0
- mot4.AngularVelocity = 0
- wait(0.25)
- PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
- wait(0.1)
- part.Anchored = false
- local speed = 0
- local throt = false
- local mod = nil
- prox = Instance.new("ProximityPrompt",part)
- prox.RequiresLineOfSight = false
- prox.Style = Enum.ProximityPromptStyle.Custom
- prox2 = Instance.new("ProximityPrompt",part)
- prox2.RequiresLineOfSight = false
- prox2.Style = Enum.ProximityPromptStyle.Custom
- prox2.KeyboardKeyCode = Enum.KeyCode.H
- prox.Triggered:Connect(function(player)
- if player.Character == mod then
- headlights()
- end
- end)
- prox3 = Instance.new("ProximityPrompt",part)
- prox3.RequiresLineOfSight = false
- prox3.Style = Enum.ProximityPromptStyle.Custom
- prox3.KeyboardKeyCode = Enum.KeyCode.G
- local starting = false
- prox3.Triggered:Connect(function(player)
- if player.Character == mod then
- if off and not starting then
- start.Volume = 2
- start.SoundId = "rbxassetid://9075587875"
- starting = true
- start:Play()
- tween:Play()
- tween.Completed:Wait()
- off = false
- starting = false
- elseif not off and not starting then
- start.Volume = 3
- start.SoundId = "rbxassetid://4655463946"
- off = true
- start:Play()
- end
- end
- end)
- honking = false
- music = Instance.new("Sound",part)
- music.Pitch = 0
- music.Volume = 0.65
- local musics = {"1838857104","1835495895","9047888542","1835495943","9047908120"}
- music.SoundId = "rbxassetid://" .. musics[math.random(1, #musics)]
- music.Ended:Connect(function(SoundId)
- local newSoundId
- do repeat
- newSoundId = "rbxassetid://" .. musics[math.random(1, #musics)]
- wait()
- until
- newSoundId ~= SoundId
- end
- music:Stop()
- music.SoundId = newSoundId
- music.TimePosition = 0
- task.wait()
- music:Play()
- end)
- music:Play()
- local honks = Instance.new("Sound",part)
- honks.SoundId = "rbxassetid://7817329753"
- honks.Looped = true
- honks.Volume = 0
- function honk(what)
- if what == true then
- honks:Play()
- honking = true
- coroutine.wrap(function()
- for i = 1,3 do
- if not honking then break end
- wait(0.00125)
- honks.Volume = math.clamp(honks.Volume + 0.666666666667,0,2)
- end
- end)()
- elseif what == false then
- honking = false
- for i = 1,3 do
- if honking then break end
- wait(0.00125)
- honks.Volume = math.clamp(honks.Volume - 0.666666666667,0,2)
- end
- honks:Stop()
- end
- end
- prox2.Triggered:Connect(function(player)
- if player.Character == mod then
- honk(true)
- end
- end)
- prox2.TriggerEnded:Connect(function(player)
- if player.Character == mod then
- honk(false)
- end
- end)
- part:GetPropertyChangedSignal("Occupant"):Connect(function()
- if part.Occupant ~= nil then
- local Model = part.Occupant:FindFirstAncestorOfClass("Model")
- if Model then
- mod = Model
- else
- mod = nil
- end
- else
- task.wait()
- mod.PrimaryPart.CFrame = mod.PrimaryPart.CFrame * CFrame.new(8,0,0)
- mod = nil
- end
- end)
- local currentthrot = 0
- local function carMove(property)
- if property == "ThrottleFloat" then
- if part.ThrottleFloat ~= 0 then
- currentthrot = part.ThrottleFloat
- throt = true
- else
- currentthrot = 0
- throt = false
- end
- end
- end
- lastthrot = 0
- part.Changed:Connect(carMove)
- coroutine.wrap(function()
- while task.wait() do
- if not off then
- steer.TargetAngle = 27.5 * -part.SteerFloat
- steer2.TargetAngle = 27.5 * -part.SteerFloat
- sound.Pitch = math.clamp((part.ThrottleFloat * speed) * 0.0425,0,1.1125)
- sound.PlaybackSpeed = math.clamp((part.ThrottleFloat * speed) * 0.0425,0,1.1125)
- sound.Volume = math.clamp(sound.Volume + 0.1,0,1.5)
- music.Pitch = math.clamp(music.Pitch + 0.05,0,1)
- idle.Volume = math.clamp(idle.Volume + 0.01,0,0.25)
- else
- steer.TargetAngle = 0
- steer2.TargetAngle = 0
- sound.Pitch = math.clamp(sound.Pitch - 0.025,0,1.1125)
- sound.PlaybackSpeed = math.clamp(sound.PlaybackSpeed - 0.025,0,1.1125)
- sound.Volume = math.clamp(sound.Volume - 0.025,0,1.5)
- idle.Volume = math.clamp(idle.Volume - 0.005,0,0.25)
- music.Pitch = math.clamp(music.Pitch - 0.01,0,1)
- end
- end
- end)()
- local reverse = false
- while task.wait() do
- if throt and math.clamp(currentthrot * math.huge,-1,1) ~= -lastthrot and not off then
- lastthrot = part.Throttle
- lights(false)
- wait(0.0525)
- speed = math.clamp(speed + 0.75,0,45)
- mot1.AngularVelocity = part.ThrottleFloat * speed
- mot2.AngularVelocity = part.ThrottleFloat * speed
- mot3.AngularVelocity = -part.ThrottleFloat * speed
- mot4.AngularVelocity = -part.ThrottleFloat * speed
- elseif throt and math.clamp(currentthrot * math.huge,-1,1) == -lastthrot and not off then
- lights(true)
- for i = 1, 35 do
- wait(0.0525)
- speed = math.clamp(speed - (1),0,45)
- mot1.AngularVelocity = lastthrot * speed
- mot2.AngularVelocity = lastthrot * speed
- mot3.AngularVelocity = -lastthrot * speed
- mot4.AngularVelocity = -lastthrot * speed
- if speed == 0 then
- lastthrot = part.Throttle
- if speed == 0 then break end
- end
- end
- elseif not throt or off then
- if speed ~= 0 then
- lights(true)
- wait(0.0325)
- else
- lights(false)
- end
- speed = math.clamp(speed - (0.75),0,45)
- mot1.AngularVelocity = lastthrot * speed
- mot2.AngularVelocity = lastthrot * speed
- mot3.AngularVelocity = -lastthrot * speed
- mot4.AngularVelocity = -lastthrot * speed
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement