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,mass)
- local a = Instance.new("Part", script)
- local a2 = Instance.new("Part", script)
- local a3 = Instance.new("Part", script)
- a.Locked = true
- a2.Locked = true
- a3.Locked = true
- PhysicsService:SetPartCollisionGroup(a, wheels)
- PhysicsService:SetPartCollisionGroup(a2, wheels)
- PhysicsService:SetPartCollisionGroup(a3, wheels)
- a2.Name = "the"
- a3.Name = "the"
- a.Name = "the"
- local density = 1
- local friction = 1.5
- 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.125,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
- a.Transparency = 1
- a.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,0,math.rad(90))
- else
- at0.CFrame = CFrame.new(2,-1,0) * CFrame.Angles(0,0,math.rad(90))
- end
- local at1 = 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 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 = -2.5
- prism.UpperLimit = 1.5
- prism.Restitution = 0
- local spring = Instance.new("SpringConstraint" , a)
- spring.Attachment0 = at1
- spring.Attachment1 = at2
- spring.Stiffness = 300000
- if not mot then
- spring.FreeLength = (3 * 0.5) * 0.5
- else
- spring.FreeLength = 3.5
- end
- spring.Enabled = true
- spring.Damping = 400
- prism.AngularActuatorType = "Motor"
- prism.MotorMaxAngularAcceleration = 1000
- prism.MotorMaxTorque = math.huge
- wait()
- a2.Anchored = false
- a.Anchored = false
- local wel = Instance.new("Weld",what)
- wel.Part0 = a
- wel.Part1 = what
- wel.C0 = cf
- return prism
- end
- part = Instance.new("VehicleSeat",script)
- part.Anchored = true
- part.CFrame = owner.Character.Head.CFrame * CFrame.new(0,-2,-2) * CFrame.Angles(0,math.rad(-90),0)
- local a2 = Instance.new("Part", script)
- local a3 = Instance.new("Part", script)
- a3.Locked = true
- a2.Locked = true
- a2.Size = Vector3.new(1.125,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"
- 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"
- a3.Anchored = true
- a2.Anchored = true
- a3.CFrame = owner.Character.Head.CFrame * CFrame.new(-8.5,0.5,-2) * CFrame.Angles(0,0,math.rad(-5))
- a2.CFrame = owner.Character.Head.CFrame * CFrame.new(-8.5,0.5,-2) * CFrame.Angles(0,0,math.rad(-5))
- a3.Color = Color3.fromRGB(163,162,165)
- a2.Color = Color3.fromRGB(27,42,53)
- part36 = Instance.new("Seat",script)
- part36.Anchored = true
- part36.CFrame = owner.Character.Head.CFrame * CFrame.new(-6,-1,0)
- part36.Size = Vector3.new(5,1,3)
- part37 = Instance.new("Seat",script)
- part37.Anchored = true
- part37.CFrame = owner.Character.Head.CFrame * CFrame.new(-6,-1,-4) * CFrame.Angles(0,math.rad(180),0)
- part37.Size = Vector3.new(5,1,3)
- part.Size = Vector3.new(7.5,2,6)
- part31 = Instance.new("Part",script)
- part31.Anchored = true
- 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()
- part31.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-2)
- part31.Size = Vector3.new(6,4,7.5)
- local pard2 = Instance.new("Part",script)
- pard2.Anchored = true
- pard2.CFrame = owner.Character.Head.CFrame * CFrame.new(5,-0.25 + 1,-2)
- pard2.Size = Vector3.new(5.5,1.75,7)
- local pard3 = Instance.new("Part",script)
- pard3.Anchored = true
- pard3.CFrame = owner.Character.Head.CFrame * CFrame.new(4.25,0.65 + 1,-2)
- pard3.Size = Vector3.new(3,0.25,6)
- local pard4 = Instance.new("Part",script)
- pard4.Anchored = true
- pard4.CFrame = owner.Character.Head.CFrame * CFrame.new(7.75,-1 + 1,-2)
- pard4.Size = Vector3.new(0.75,2.75,7)
- part5 = Instance.new("Part",script)
- part5.Anchored = true
- part5.CFrame = owner.Character.Head.CFrame * CFrame.new(6,-0.75 + 1,-5.75)
- part5.Size = Vector3.new(3.75,0.75,1.125)
- part6 = Instance.new("Part",script)
- part6.Anchored = true
- part6.CFrame = owner.Character.Head.CFrame * CFrame.new(6,-0.75 + 1,1.75)
- part6.Size = Vector3.new(3.75,0.75,1.125)
- part7 = Instance.new("Part",script)
- part7.Anchored = true
- part7.CFrame = owner.Character.Head.CFrame * CFrame.new(-5.5,-1 + 1,-2)
- part7.Size = Vector3.new(4.75,0.75,8)
- part8 = Instance.new("Part",script)
- part8.Anchored = true
- part8.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.25,-1.75 + 1,-2)
- part8.Size = Vector3.new(1.75,2.5,8.25)
- part9 = Instance.new("Part",script)
- part9.Anchored = true
- part9.CFrame = owner.Character.Head.CFrame * CFrame.new(7.95,-1.95 + 1,-2)
- part9.Size = Vector3.new(1.25,0.75,8.25)
- part10 = Instance.new("Part",script)
- part10.Anchored = true
- part10.CFrame = owner.Character.Head.CFrame * CFrame.new(-8,-2.5 + 1,-2)
- part10.Size = Vector3.new(1,0.75,8.25)
- part11 = Instance.new("Part",script)
- part11.Anchored = true
- part11.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.65,-1 + 1,-2) * CFrame.Angles(0,0,math.rad(-6.5))
- part11.Size = Vector3.new(1,3,7)
- part12 = Instance.new("Part",script)
- part12.Anchored = true
- part12.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.05,0.75 + 1,-2) * CFrame.Angles(0,0,math.rad(-15))
- part12.Size = Vector3.new(1.5,2,6.25)
- part13 = Instance.new("Part",script)
- part13.Anchored = true
- part13.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.85,1.5 + 1,-2) * CFrame.Angles(0,0,math.rad(-16.5))
- part13.Size = Vector3.new(1.5,2,6)
- part14 = Instance.new("Part",script)
- part14.Anchored = true
- part14.CFrame = owner.Character.Head.CFrame * CFrame.new(-3.125,2.65 + 1,-2)
- part14.Size = Vector3.new(8.175,0.35,5.75)
- part15 = Instance.new("Part",script)
- part15.Anchored = true
- part15.CFrame = owner.Character.Head.CFrame * CFrame.new(-3.5,2.85 + 1,-2)
- part15.Size = Vector3.new(7.25,0.35,4.75)
- part16 = Instance.new("Part",script)
- part16.Anchored = true
- part16.CFrame = owner.Character.Head.CFrame * CFrame.new(3.5,0.75 + 1,-2)
- part16.Size = Vector3.new(1.5,0.25,4)
- part17 = Instance.new("Part",script)
- part17.Anchored = true
- part17.CFrame = owner.Character.Head.CFrame * CFrame.new(3.8,-1.7 + 1,1.65) * CFrame.Angles(math.rad(10),0,math.rad(-22.5))
- part17.Size = Vector3.new(0.65,2.5,1.125)
- part18 = Instance.new("Part",script)
- part18.Anchored = true
- part18.CFrame = owner.Character.Head.CFrame * CFrame.new(3.8,-1.7 + 1,-5.65) * CFrame.Angles(math.rad(-10),0,math.rad(-22.5))
- part18.Size = Vector3.new(0.65,2.5,1.125)
- part19 = Instance.new("Part",script)
- part19.Anchored = true
- part19.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.75,-1.95 + 1,-2) * CFrame.Angles(0,0,math.rad(15))
- part19.Size = Vector3.new(0.65,2.125,8.125)
- part20 = Instance.new("Part",script)
- part20.Anchored = true
- part20.CFrame = owner.Character.Head.CFrame * CFrame.new(-3.125,-2.125 + 1,-2) * CFrame.Angles(0,0,math.rad(25))
- part20.Size = Vector3.new(0.35,1.85,8.65)
- part21 = Instance.new("Part",script)
- part21.Anchored = true
- part21.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.65,-1.35 + 1,-2)
- part21.Size = Vector3.new(2.125,0.35,8.65)
- part22 = Instance.new("Part",script)
- part22.Anchored = true
- part22.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.125,-2.125 + 1,-2) * CFrame.Angles(0,0,math.rad(-25))
- part22.Size = Vector3.new(0.35,1.85,8.65)
- part23 = Instance.new("Part",script)
- part23.Anchored = true
- part23.CFrame = owner.Character.Head.CFrame * CFrame.new(0.8,1.125 + 1,0.35) * CFrame.Angles(math.rad(-10),0,math.rad(35))
- part23.Size = Vector3.new(2,2.65,1.5)
- part24 = Instance.new("Part",script)
- part24.Anchored = true
- part24.CFrame = owner.Character.Head.CFrame * CFrame.new(0.8,1.125 + 1,-4.35) * CFrame.Angles(math.rad(10),0,math.rad(35))
- part24.Size = Vector3.new(2,2.65,1.5)
- part25 = Instance.new("Part",script)
- part25.Anchored = true
- part25.CFrame = owner.Character.Head.CFrame * CFrame.new(-3,1.125 + 1,0.65) * CFrame.Angles(math.rad(-10),0,0)
- part25.Size = Vector3.new(7,2.65,1)
- part26 = Instance.new("Part",script)
- part26.Anchored = true
- part26.CFrame = owner.Character.Head.CFrame * CFrame.new(-3,1.125 + 1,-4.65) * CFrame.Angles(math.rad(10),0,0)
- part26.Size = Vector3.new(7,2.65,1)
- part27 = Instance.new("Part",script)
- part27.Anchored = true
- part27.CFrame = owner.Character.Head.CFrame * CFrame.new(1.5,1.5 + 1,-2) * CFrame.Angles(0,0,math.rad(35))
- part27.Size = Vector3.new(1,2.65,5.5)
- part28 = Instance.new("Part",script)
- part28.Anchored = true
- part28.CFrame = owner.Character.Head.CFrame * CFrame.new(1.85,1.175 + 1,-2) * CFrame.Angles(0,0,math.rad(37.5))
- part28.Size = Vector3.new(1,1.5,3.75)
- part29 = Instance.new("Part",part)
- part29.CanCollide = false
- part29.Transparency = 0
- 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"
- part34 = Instance.new("Part",script)
- part34.Anchored = true
- part34.CFrame = owner.Character.Head.CFrame * CFrame.new(8,0.25,-4.75)
- part34.Size = Vector3.new(0.455,1.035, 1.035)
- part34.Shape = "Cylinder"
- part34.Material = "Glass"
- part35 = Instance.new("Part",script)
- part35.Anchored = true
- part35.CFrame = owner.Character.Head.CFrame * CFrame.new(8,0.25,0.75)
- part35.Shape = "Cylinder"
- part35.Size = Vector3.new(0.455,1.035, 1.035)
- part35.Material = "Glass"
- local hitdb = false
- 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,1,-8)
- 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
- part34.BrickColor = BrickColor.new("Medium Stone Grey")
- part34.Material = "Glass"
- part35.BrickColor = BrickColor.new("Medium Stone Grey")
- part35.Material = "Glass"
- end
- end
- local part2 = Instance.new("Part",part)
- part2.CFrame = owner.Character.Head.CFrame
- part2.CanCollide = false
- local part3 = Instance.new("Part",part)
- part3.CFrame = owner.Character.Head.CFrame
- part3.CanCollide = false
- local ats = Instance.new("Attachment",part29)
- ats.CFrame = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- local ats2 = Instance.new("Attachment",part2)
- ats2.CFrame = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))
- local steer = Instance.new("HingeConstraint",part29)
- steer.LimitsEnabled = true
- steer.LowerAngle = -20
- steer.UpperAngle = 20
- steer.Attachment0 = ats
- steer.Attachment1 = ats2
- local ats3 = Instance.new("Attachment",part)
- ats3.CFrame = CFrame.new(0,0,4.65) * CFrame.Angles(0,math.rad(90),0)
- local ats4 = Instance.new("Attachment",part3)
- ats4.CFrame = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- local steer2 = Instance.new("HingeConstraint",part)
- steer2.LimitsEnabled = true
- steer2.LowerAngle = -20
- steer2.UpperAngle = 20
- steer2.Attachment0 = ats3
- steer2.Attachment1 = ats4
- local steer = Instance.new("BallSocketConstraint",part)
- steer.Attachment0 = ats
- steer.Attachment1 = ats2
- steer.MaxFrictionTorque = 500
- local ats = Instance.new("Attachment",part)
- ats.CFrame = CFrame.new(0,0,-5.65) * CFrame.Angles(0,math.rad(0),math.rad(90))
- local ats2 = Instance.new("Attachment",part29)
- ats2.CFrame = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),math.rad(90))
- part29.CFrame = part.CFrame * ats.CFrame
- part2.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
- local off = true
- owner.Character.Head.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,2)
- local mesh = Instance.new("SpecialMesh",part31)
- mesh.Scale = Vector3.new(0.35,0.35,0.35)
- mesh.MeshId = "rbxassetid://3651987136"
- mesh.TextureId = "rbxassetid://3710187949"
- mesh.Offset = Vector3.new(0,1,0)
- 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
- end
- end
- for i,v in pairs(script:GetDescendants()) do
- if v:IsA("Part") then
- PhysicsService:SetPartCollisionGroup(v, car)
- v.Locked = true
- local density = 3
- local friction = 1
- local elasticity = 0
- local frictionWeight = 10000
- local elasticityWeight = 100000
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- v.CustomPhysicalProperties = physProperties
- end
- end
- wait()
- local t = Instance.new("Torque",part)
- local ats = Instance.new("Attachment",part)
- t.Attachment0 = ats
- t.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
- t.Torque = Vector3.new()
- part.Transparency = 1
- part.Locked = true
- part31.Material = "Plastic"
- a2.Transparency = 0
- a3.Transparency = 0
- part.CanCollide = false
- part31.Transparency = 0
- part33.Transparency = 0
- part32.Transparency = 0
- part34.Transparency = 0
- part35.Transparency = 0
- part29.Transparency = 1
- PhysicsService:SetPartCollisionGroup(part, car)
- local mass = 0
- for i,v in pairs(script:GetDescendants()) do
- pcall(function()
- mass += v:GetMass()
- end)
- end
- part2.CanCollide = false
- part3.CanCollide = false
- part29.CanCollide = false
- part2.Transparency = 1
- part3.Transparency = 1
- part29.Transparency = 1
- local mot1 = suspension(part2,CFrame.new(-2.5,0.5,0) * CFrame.Angles(0,math.rad(0),0),false,"Back",mass)
- local mot2 = suspension(part3,CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,math.rad(0),0),true,"Back",mass)
- local mot3 = suspension(part2,CFrame.new(-2.5,0.5,0) * CFrame.Angles(0,math.rad(180),0),false,"Front",mass)
- local mot4 = suspension(part3,CFrame.new(-1.5,0.5,0) * CFrame.Angles(0,math.rad(180),0),true,"Front",mass)
- 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 mod2 = nil
- local mod3 = nil
- part36:GetPropertyChangedSignal("Occupant"):Connect(function()
- if part36.Occupant ~= nil then
- local Model = part36.Occupant:FindFirstAncestorOfClass("Model")
- if Model then
- mod2 = Model
- else
- mod2 = nil
- end
- else
- task.wait()
- mod2.PrimaryPart.CFrame = mod2.PrimaryPart.CFrame * CFrame.new(0,0,4)
- mod2 = nil
- end
- end)
- part37:GetPropertyChangedSignal("Occupant"):Connect(function()
- if part37.Occupant ~= nil then
- local Model = part37.Occupant:FindFirstAncestorOfClass("Model")
- if Model then
- mod3 = Model
- else
- mod3 = nil
- end
- else
- task.wait()
- mod3.PrimaryPart.CFrame = mod3.PrimaryPart.CFrame * CFrame.new(0,0,4)
- mod3 = 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
- sound.Pitch = math.clamp(speed * 0.0425,0,1.1125)
- sound.PlaybackSpeed = math.clamp(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
- 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 * 500,-1,1) ~= -lastthrot and not off then
- lastthrot = part.Throttle
- lights(false)
- wait(0.0525)
- speed = math.clamp(speed + 0.75,0,35)
- 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 * 500,-1,1) == -lastthrot and not off then
- lights(true)
- for i = 1, 35 do
- wait(0.0525)
- speed = math.clamp(speed - 1,0,35)
- 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,35)
- mot1.AngularVelocity = lastthrot * speed
- mot2.AngularVelocity = lastthrot * speed
- mot3.AngularVelocity = -lastthrot * speed
- mot4.AngularVelocity = -lastthrot * speed
- end
- end
Add Comment
Please, Sign In to add comment