Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function suspension(what,cf,mot)
- local a = Instance.new("Part", script)
- local a2 = Instance.new("Part", script)
- local a3 = Instance.new("Part", script)
- a2.Name = "the"
- a3.Name = "the"
- a.Name = "the"
- local density = 8
- local friction = 1.5
- local elasticity = 0
- local frictionWeight = 10
- 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,3)
- a2.Shape = "Cylinder"
- a2.Material = "SmoothPlastic"
- a3.Size = Vector3.new(0.125,1.75,1.75)
- a3.Shape = "Cylinder"
- a3.Material = "SmoothPlastic"
- a2.Color = Color3.fromRGB(30,30,30)
- local weld = Instance.new("Weld",a2)
- weld.Part0 = a3
- weld.Part1 = a2
- weld.C0 = CFrame.new(-0.55,0,0)
- 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 at0 = Instance.new("Attachment" , a)
- at0.CFrame = CFrame.new(2,-1,0) * CFrame.Angles(0,0,math.rad(-90))
- 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 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
- local spring = Instance.new("SpringConstraint" , a)
- spring.Attachment0 = at1
- spring.Attachment1 = at2
- spring.Stiffness = 30000
- spring.FreeLength = 2.2
- spring.Enabled = true
- spring.Damping = 400
- if mot then
- prism.AngularActuatorType = "Motor"
- prism.MotorMaxAngularAcceleration = 1000
- prism.MotorMaxTorque = math.huge
- end
- 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)
- trail = Instance.new("Part",script)
- local sound = Instance.new("Sound",part)
- sound.Looped = true
- sound.Volume = 3
- sound.SoundId = "rbxassetid://9112787518"
- sound:Play()
- part.Size = Vector3.new(3,1,11)
- trail.Size = Vector3.new(7,1,13)
- trail.Anchored = true
- part.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,-5)
- trail.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,5)
- trail.Material = "SmoothPlastic"
- part.Anchored = true
- local part4 = Instance.new("Part",part)
- part4.Size = Vector3.new(3,1,0.25)
- part.Material = "SmoothPlastic"
- part4.Material = "SmoothPlastic"
- local part5 = Instance.new("Part",part)
- part5.Size = Vector3.new(2,2.5,0.5)
- part5.Material = "SmoothPlastic"
- local part6 = Instance.new("Part",part)
- part6.Size = Vector3.new(2.05,2.55,0.45)
- part6.Material = "SmoothPlastic"
- local part7 = Instance.new("Part",part)
- part7.Size = Vector3.new(1.75,1,0.125)
- part7.Material = "SmoothPlastic"
- part5.Color = Color3.fromRGB(122, 85, 4)
- local wel = Instance.new("Weld",part)
- wel.Part0 = part4
- wel.Part1 = part
- wel.C0 = CFrame.new(0,0,5.5)
- local wel2 = Instance.new("Weld",part)
- wel2.Part0 = part5
- wel2.Part1 = part
- wel2.C0 = CFrame.new(0,-1.75,-1) * CFrame.Angles(math.rad(-15),0,0)
- local wel3 = Instance.new("Weld",part)
- wel3.Part0 = part6
- wel3.Part1 = part
- wel3.C0 = CFrame.new(0,-1.75,-1.075) * CFrame.Angles(math.rad(-15),0,0)
- local wel4 = Instance.new("Weld",part)
- wel4.Part0 = part7
- wel4.Part1 = part
- wel4.C1 = CFrame.new(0,2.5,-2) * CFrame.Angles(math.rad(-10),0,0)
- part2 = Instance.new("Part",part)
- part2.CanCollide = false
- part2.Transparency = 1
- local ats = Instance.new("Attachment",part)
- ats.CFrame = CFrame.new(1.25,0,-3.825) * CFrame.Angles(0,0,math.rad(90))
- local ats2 = Instance.new("Attachment",part2)
- ats2.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,0,math.rad(90))
- 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
- part3 = Instance.new("Part",part)
- part3.CanCollide = false
- part3.Transparency = 1
- local ats3 = Instance.new("Attachment",part)
- ats3.CFrame = CFrame.new(-1.25,0,-3.825) * CFrame.Angles(0,0,math.rad(90))
- local ats4 = Instance.new("Attachment",part3)
- ats4.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,0,math.rad(90))
- part3.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
- local trailer = Instance.new("BallSocketConstraint",part)
- function seat(cf1,cf2,cf3)
- local part10 = Instance.new("Seat",trail)
- part10.Size = Vector3.new(3,0.5,1.5)
- part10.Material = "SmoothPlastic"
- local part11 = Instance.new("Part",trail)
- part11.Size = Vector3.new(3.05,0.5,1.55)
- part11.Material = "SmoothPlastic"
- part10.Color = Color3.fromRGB(122, 85, 4)
- local wel7 = Instance.new("Weld",trail)
- wel7.Part0 = part10
- wel7.Part1 = trail
- wel7.C0 = CFrame.new(-cf3,-0.5,-cf1) * CFrame.Angles(0,math.rad(cf2),0)
- local wel8 = Instance.new("Weld",trail)
- wel8.Part0 = part11
- wel8.Part1 = trail
- wel8.C0 = CFrame.new(-cf3,-0.425,-cf1) * CFrame.Angles(0,math.rad(cf2),0)
- end
- seat(2.5,90,3.5)
- seat(2.5,-90,-3.5)
- seat(2.5,-90,-0.5)
- seat(2.5,90,0.5)
- local atc = Instance.new("Attachment",part)
- atc.CFrame = CFrame.new(0,0,6)
- local atc2 = Instance.new("Attachment",trail)
- atc2.CFrame = CFrame.new(0,0,-7)
- trailer.Attachment1 = atc2
- trailer.Attachment0 = atc
- trailer.LimitsEnabled = true
- trailer.UpperAngle = 35
- trailer.TwistLimitsEnabled = true
- trailer.TwistLowerAngle = -55
- trailer.TwistUpperAngle = 55
- trailer.Enabled = false
- local count = 0
- owner.Chatted:Connect(function(msg)
- if msg:lower() == "-trailer" then
- count += 1
- if count == 1 then
- if (atc.WorldCFrame.Position - atc2.WorldCFrame.Position).Magnitude < 3 then
- trailer.Enabled = true
- else
- count = 0
- end
- elseif count == 2 then
- trailer.Enabled = false
- count = 0
- end
- end
- end)
- wait()
- local mot1 = suspension(part2,CFrame.new(0,0,0) * CFrame.Angles(0,0,0),true)
- local mot2 = suspension(part,CFrame.new(-1.25,1,-3.5),true)
- local mot3 = suspension(part3,CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(180),0),true)
- local mot4 = suspension(part,CFrame.new(-1.25,1,3.5) * CFrame.Angles(0,math.rad(180),0),true)
- suspension(trail,CFrame.new(-2.25,1,0.25) * CFrame.Angles(0,math.rad(180),0),false)
- suspension(trail,CFrame.new(-2.25,1,-0.25),false)
- suspension(trail,CFrame.new(-2.25,1,3.5) * CFrame.Angles(0,math.rad(180),0),false)
- suspension(trail,CFrame.new(-2.25,1,-3.5),false)
- mot1.AngularVelocity = 0
- mot2.AngularVelocity = 0
- mot3.AngularVelocity = 0
- mot4.AngularVelocity = 0
- wait(0.1)
- part.Anchored = false
- trail.Anchored = false
- local speed = 0
- local throt = false
- local function carMove(property)
- if property == "ThrottleFloat" then
- if part.ThrottleFloat ~= 0 then
- throt = true
- else
- throt = false
- end
- mot1.AngularVelocity = -part.ThrottleFloat * speed
- mot2.AngularVelocity = -part.ThrottleFloat * speed
- mot3.AngularVelocity = part.ThrottleFloat * speed
- mot4.AngularVelocity = part.ThrottleFloat * speed
- end
- end
- lastthrot = 0
- local hits = {"rbxassetid://7340406550","rbxassetid://7340406466","rbxassetid://7340406573"}
- local hitsound = Instance.new("Sound")
- hitsound.PlayOnRemove = true
- hitsound.Volume = 0.5
- local pe = Instance.new("ParticleEmitter")
- pe.Color = ColorSequence.new(Color3.fromRGB(250, 238, 17))
- pe.LightEmission = 1
- pe.LightInfluence = 0.125
- pe.EmissionDirection = "Top"
- pe.Orientation = Enum.ParticleOrientation.VelocityParallel
- pe.Size = NumberSequence.new(0.35,0)
- pe.Texture = "rbxassetid://243132757"
- pe.Transparency = NumberSequence.new(0,1)
- pe.Lifetime = NumberRange.new(0.5,1)
- pe.Rate = 200
- pe.Enabled = false
- pe.Rotation = NumberRange.new(90)
- pe.RotSpeed = NumberRange.new(0)
- pe.Speed = NumberRange.new(30)
- pe.SpreadAngle = Vector2.new(-35,35)
- pe.Drag = NumberRange.new(1)
- pe.Acceleration = Vector3.new(0,-65,0)
- part.Changed:Connect(carMove)
- coroutine.wrap(function()
- while task.wait() do
- steer.TargetAngle = 37.5 * -part.SteerFloat
- steer2.TargetAngle = 37.5 * -part.SteerFloat
- sound.Pitch = math.clamp(speed * 0.0625,1,20)
- wel4.C0 = wel4.C0:lerp(CFrame.Angles(0,0,math.rad(50 * part.SteerFloat)),0.15)
- end
- end)()
- for i,v in pairs(script:GetDescendants()) do
- if v:IsA("Part") then
- v.Touched:Connect(function(hit)
- if (v.Velocity.Magnitude - hit.Velocity.Magnitude) > 25 and not hit:IsDescendantOf(script) and v.Name ~= "the" then
- hitsound.SoundId = hits[math.random(1,3)]
- hitsound.Parent = v
- hitsound.Parent = nil
- pe.Parent = v
- pe:Emit(50)
- end
- end)
- end
- end
- while task.wait() do
- if throt and throt ~= -lastthrot then
- lastthrot = part.ThrottleFloat
- wait(0.0525)
- speed = math.clamp(speed + 0.5,0,30)
- mot1.AngularVelocity = -part.ThrottleFloat * speed
- mot2.AngularVelocity = -part.ThrottleFloat * speed
- mot3.AngularVelocity = part.ThrottleFloat * speed
- mot4.AngularVelocity = part.ThrottleFloat * speed
- elseif throt and throt == -lastthrot then
- for i = 1, 60 do
- wait(0.0525)
- speed = math.clamp(speed - 0.5,0,30)
- mot1.AngularVelocity = -lastthrot * speed
- mot2.AngularVelocity = -lastthrot * speed
- mot3.AngularVelocity = lastthrot * speed
- mot4.AngularVelocity = lastthrot * speed
- if i == 40 then
- lastthrot = part.Throttle
- end
- end
- elseif not throt then
- if speed ~= 0 then
- wait(0.0325)
- end
- speed = math.clamp(speed - 0.75,0,30)
- 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