Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local gas = 2000
- 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)
- speed = 0
- local part = Instance.new("Part",script)
- part.Anchored = true
- part.CFrame = owner.Character.Head.CFrame
- part.Size = Vector3.new(10,0.1,28)
- local part2 = Instance.new("Part",script)
- part2.Anchored = true
- part2.CanCollide = false
- part2.CFrame = owner.Character.Head.CFrame
- local part3 = Instance.new("Part",script)
- part3.Anchored = true
- part3.CanCollide = false
- part3.CFrame = owner.Character.Head.CFrame
- local part4 = Instance.new("Part",script)
- part4.Anchored = true
- part4.CanCollide = false
- part4.CFrame = owner.Character.Head.CFrame
- local par = Instance.new("WedgePart",script)
- par.Anchored = true
- par.CFrame = owner.Character.Head.CFrame * CFrame.new(0,5,-15)
- par.Size = Vector3.new(10,6,2)
- local par2 = Instance.new("Part",script)
- par2.Anchored = true
- par2.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.75,4,0)
- par2.Size = Vector3.new(1.5,8,28)
- local par3 = Instance.new("Part",script)
- par3.Anchored = true
- par3.CFrame = owner.Character.Head.CFrame * CFrame.new(4.75,4,5.5)
- par3.Size = Vector3.new(1.5,8,17)
- local par4 = Instance.new("Part",script)
- par4.Anchored = true
- par4.CFrame = owner.Character.Head.CFrame * CFrame.new(4.75,4,-10)
- par4.Size = Vector3.new(1.5,8,8)
- local par5 = Instance.new("Part",script)
- par5.Anchored = true
- par5.CFrame = owner.Character.Head.CFrame * CFrame.new(0,4,14)
- par5.Size = Vector3.new(10,8,1.5)
- local par6 = Instance.new("Part",script)
- par6.Anchored = true
- par6.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,2.5,14.75)
- par6.Size = Vector3.new(1.5,4,1.5)
- local par7 = Instance.new("Part",script)
- par7.Anchored = true
- par7.CFrame = owner.Character.Head.CFrame * CFrame.new(0,8,0)
- par7.Size = Vector3.new(10,0.5,28)
- local par8 = Instance.new("WedgePart",script)
- par8.Anchored = true
- par8.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0.5,-15)
- par8.Size = Vector3.new(10,3,2)
- par8.CFrame = par8.CFrame * CFrame.Angles(math.rad(180),math.rad(180),0)
- local par9 = Instance.new("Part",script)
- par9.Anchored = true
- par9.CFrame = owner.Character.Head.CFrame * CFrame.new(4.5,2.5,11.75)
- par9.Size = Vector3.new(0.1,0.75,0.75)
- par9.Shape = "Cylinder"
- par9.Material = "SmoothPlastic"
- par9.Color = Color3.fromRGB(50,50,50)
- local vseat = Instance.new("VehicleSeat",script)
- vseat.Anchored = true
- vseat.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,-11)
- vseat.Size = Vector3.new(2.5,1.5,2)
- local seat = Instance.new("Seat",script)
- seat.Anchored = true
- seat.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,0)
- seat.Size = Vector3.new(1.5,1.5,2)
- local seat2 = Instance.new("Seat",script)
- seat2.Anchored = true
- seat2.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,4)
- seat2.Size = Vector3.new(1.5,1.5,2)
- local seat3 = Instance.new("Seat",script)
- seat3.Anchored = true
- seat3.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,8)
- seat3.Size = Vector3.new(1.5,1.5,2)
- local seat4 = Instance.new("Seat",script)
- seat4.Anchored = true
- seat4.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,12)
- seat4.Size = Vector3.new(1.5,1.5,2)
- local seat5 = Instance.new("Seat",script)
- seat5.Anchored = true
- seat5.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,0)
- seat5.Size = Vector3.new(1.5,1.5,2)
- local seat6 = Instance.new("Seat",script)
- seat6.Anchored = true
- seat6.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,4)
- seat6.Size = Vector3.new(1.5,1.5,2)
- local seat7 = Instance.new("Seat",script)
- seat7.Anchored = true
- seat7.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,8)
- seat7.Size = Vector3.new(1.5,1.5,2)
- local seat8 = Instance.new("Seat",script)
- seat8.Anchored = true
- seat8.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,12)
- seat8.Size = Vector3.new(1.5,1.5,2)
- local seat9 = Instance.new("Seat",script)
- seat9.Anchored = true
- seat9.CFrame = owner.Character.Head.CFrame * CFrame.new(0,1,12)
- seat9.Size = Vector3.new(1.5,1.5,2)
- owner.Character.Head.CFrame = owner.Character.Head.CFrame * CFrame.new(8,0,-1)
- task.wait()
- local tab = script:GetDescendants()
- for i,v in pairs(tab) do
- if i >= 2 then
- if v:IsA("BasePart") and tab[i - 1]:IsA("BasePart") then
- local weld = Instance.new("WeldConstraint")
- weld.Part0 = tab[i - 1]
- weld.Part1 = v
- weld.Parent = v
- end
- end
- end
- task.wait()
- for i,v in pairs(script:GetDescendants()) do
- pcall(function()
- v.Transparency = 1
- PhysicsService:SetPartCollisionGroup(v, car)
- v.Anchored = false
- end)
- end
- task.wait()
- local attttt0 = Instance.new("Attachment",par6)
- attttt0.CFrame = CFrame.new(0,2.4,1.2)
- local pe = Instance.new("ParticleEmitter", attttt0)
- pe.LightEmission = 0
- pe.LightInfluence = 1
- pe.EmissionDirection = Enum.NormalId.Back
- pe.VelocityInheritance = 0.5
- pe.Orientation = Enum.ParticleOrientation.FacingCamera
- pe.Size = NumberSequence.new{NumberSequenceKeypoint.new(0, 0.5),NumberSequenceKeypoint.new(1, 1)}
- pe.Texture = "rbxassetid://34098552"
- pe.Transparency = NumberSequence.new(0.2,0.4)
- pe.Lifetime = NumberRange.new(1,1.25)
- pe.Rate = 500
- pe.Rotation = NumberRange.new(math.random(-360,360))
- pe.RotSpeed = NumberRange.new(10)
- pe.Speed = NumberRange.new(1,3)
- pe.Acceleration = Vector3.new(0,10,0)
- pe.Color = ColorSequence.new(Color3.fromRGB(50, 50, 50))
- pe.SpreadAngle = Vector2.new(-5,5)
- pe.Drag = NumberRange.new(2,2.5)
- pe.Lifetime = NumberRange.new(1,1.2)
- vseat.MaxSpeed = 50
- vseat.Torque = 50
- vseat.TurnSpeed *= 1.5
- part2.Transparency = 0
- part3.Transparency = 0
- part4.Transparency = 0
- part.Transparency = 0
- local m = Instance.new("SpecialMesh",part2)
- m.MeshId = "rbxassetid://1210270510"
- m.TextureId = "rbxassetid://1210272315"
- m.Offset = Vector3.new(0,0.2,0.4) + Vector3.new(0,4.1,0)
- local m = Instance.new("SpecialMesh",part3)
- m.MeshId = "rbxassetid://1210270416"
- m.TextureId = "rbxassetid://1210272560"
- m.Offset = Vector3.new(0,-0.165,-0.65) + Vector3.new(0,4.1,0)
- m.Scale = Vector3.new(1,1,1)
- local m = Instance.new("SpecialMesh",part4)
- m.MeshId = "rbxassetid://1210270337"
- m.TextureId = "rbxassetid://1210273136"
- m.Offset = Vector3.new(0,-0.325,-0.55) + Vector3.new(0,4.1,0)
- local m = Instance.new("SpecialMesh",part)
- m.MeshId = "rbxassetid://1210267410"
- m.TextureId = "rbxassetid://1210272211"
- m.Offset = Vector3.new(0,4.1,0)
- part.Anchored = true
- local tool = Instance.new("Tool",owner.Backpack)
- tool.Name = "Bus Key"
- local key = Instance.new("Part",tool)
- key.Name = "Handle"
- key.Size = Vector3.new(0.5,0.25,0.75)
- local tool2 = Instance.new("Tool",owner.Backpack)
- tool2.Name = "Gas"
- local gass = Instance.new("Part",tool2)
- gass.Name = "Handle"
- gass.Size = Vector3.new(1.25, 2.164 + 0.5, 2)
- local m = Instance.new("SpecialMesh",gass)
- m.MeshId = "rbxassetid://461734736"
- m.TextureId = "rbxassetid://461734743"
- tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- local istouched = false
- par9.Touched:Connect(function(wha)
- if wha == gass and gas ~= 3000 then
- istouched = true
- tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0) * CFrame.Angles(math.rad(45),0,0)
- end
- end)
- par9.TouchEnded:Connect(function(wha)
- if wha == gass then
- istouched = false
- tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- end
- end)
- coroutine.wrap(function()
- while game:GetService("RunService").Heartbeat:Wait() do
- if istouched then
- gas = math.clamp(gas + 30,0,3000)
- if gas == 3000 then
- tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- end
- end
- if gas == 3000 then
- tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
- end
- end
- end)()
- local wheel = Instance.new("Part",vseat)
- local wheel2 = Instance.new("Part",vseat)
- local wheel3 = Instance.new("Part",vseat)
- local wheel4 = Instance.new("Part",vseat)
- wheel.Material = "Fabric"
- wheel2.Material = "Fabric"
- wheel3.Material = "Fabric"
- wheel4.Material = "Fabric"
- PhysicsService:SetPartCollisionGroup(wheel, wheels)
- PhysicsService:SetPartCollisionGroup(wheel2, wheels)
- PhysicsService:SetPartCollisionGroup(wheel3, wheels)
- PhysicsService:SetPartCollisionGroup(wheel4, wheels)
- PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
- wheel.Anchored = true
- wheel2.Anchored = true
- wheel3.Anchored = true
- wheel4.Anchored = true
- wheel.Size = Vector3.new(1,4,4)
- wheel.Shape = "Cylinder"
- wheel2.Size = Vector3.new(1,4,4)
- wheel2.Shape = "Cylinder"
- wheel3.Size = Vector3.new(1,4,4)
- wheel3.Shape = "Cylinder"
- wheel4.Size = Vector3.new(1,4,4)
- wheel4.Shape = "Cylinder"
- local m = Instance.new("SpecialMesh",wheel)
- m.MeshId = "rbxassetid://5738250964"
- m.TextureId = "rbxassetid://5738250999"
- local m = Instance.new("SpecialMesh",wheel2)
- m.MeshId = "rbxassetid://5738250964"
- m.TextureId = "rbxassetid://5738250999"
- local m = Instance.new("SpecialMesh",wheel3)
- m.MeshId = "rbxassetid://5738250964"
- m.TextureId = "rbxassetid://5738250999"
- local m = Instance.new("SpecialMesh",wheel4)
- m.MeshId = "rbxassetid://5738250964"
- m.TextureId = "rbxassetid://5738250999"
- wheel.CFrame = part.CFrame * CFrame.new(4.5,0,6.5)
- wheel2.CFrame = part.CFrame * CFrame.new(4.5,0,-9)
- wheel3.CFrame = part.CFrame * CFrame.new(-4.5,0,6.5)
- wheel3.CFrame = wheel3.CFrame * CFrame.Angles(0,math.rad(180),0)
- wheel4.CFrame = part.CFrame * CFrame.new(-4.5,0,-9)
- wheel4.CFrame = wheel4.CFrame * CFrame.Angles(0,math.rad(180),0)
- local density = 10
- local friction = 1
- local elasticity = 0
- local frictionWeight = 10000
- local elasticityWeight = 100000
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- part.CustomPhysicalProperties = physProperties
- local density = 3
- local friction = 3
- local elasticity = 1
- local frictionWeight = 100
- local elasticityWeight = 1
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- wheel.CustomPhysicalProperties = physProperties
- wheel2.CustomPhysicalProperties = physProperties
- wheel3.CustomPhysicalProperties = physProperties
- wheel4.CustomPhysicalProperties = physProperties
- local part29 = Instance.new("Part",part)
- part29.CanCollide = false
- part29.Transparency = 1
- local sound = Instance.new("Sound",part)
- sound.Looped = true
- sound.Volume = 0
- sound.SoundId = "rbxassetid://1289983500"
- sound:Play()
- local sound2 = Instance.new("Sound",part)
- sound2.Looped = true
- sound2.Volume = 0
- sound2:Play()
- sound2.SoundId = "rbxassetid://431021517"
- local brakes = Instance.new("Sound",part)
- brakes.Volume = 1.5
- brakes.SoundId = "rbxassetid://1704258021"
- brakes.PlaybackSpeed = 0.8
- local bigbrakes = Instance.new("Sound",part)
- bigbrakes.Volume = 0.5
- bigbrakes.Looped = true
- bigbrakes.SoundId = "rbxassetid://1858905327"
- local wha = false
- brakes.Ended:Connect(function()
- if wha == false then
- bigbrakes:Play()
- wha = true
- else
- wha = false
- end
- end)
- par9.Transparency = 0
- local steerw = Instance.new("Part",script)
- steerw.CanCollide = false
- local m = Instance.new("SpecialMesh",steerw)
- m.MeshId = "rbxassetid://129344524"
- m.TextureId = "rbxassetid://129344702"
- local wel4 = Instance.new("Weld",vseat)
- wel4.Part0 = steerw
- wel4.Part1 = vseat
- wel4.C1 = CFrame.new(-0.1,2.5,-2) * CFrame.Angles(math.rad(-35),0,0)
- local door1 = Instance.new("Part",script)
- door1.Size = Vector3.new(0.125,6.75,3.25 * 0.5)
- door1.Color = Color3.fromRGB(85,85,90)
- local wel = Instance.new("Weld",part)
- wel.Part0 = door1
- wel.Part1 = part
- wel.C1 = CFrame.new(4.4,3.125,-(((4.4 * 1.25) - 0.3) + 0.75))
- wel.C0 = CFrame.new(0,0,-0.75)
- local door2 = Instance.new("Part",script)
- door2.Size = Vector3.new(0.125,6.75,3.25 * 0.5)
- door2.Color = Color3.fromRGB(85,85,90)
- local wel2 = Instance.new("Weld",door1)
- wel2.Part0 = door2
- wel2.Part1 = door1
- wel2.C1 = CFrame.new(0,0,3.25 * 0.25)
- wel2.C0 = CFrame.new(0,0,-3.25 * 0.25)
- local tweenService = game:GetService("TweenService")
- local timeToFade = 2.5
- local object = wel
- local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
- local goal = {}
- goal.C0 = CFrame.new(0,0,-0.75) * CFrame.Angles(0,math.rad(-89),0)
- local doort = tweenService:Create(object, tweenInfo, goal)
- local goal = {}
- goal.C0 = CFrame.new(0,0,-0.75) * CFrame.Angles(0,math.rad(-0.5),0)
- local doort3 = tweenService:Create(object, tweenInfo, goal)
- local timeToFade = 2.5
- local object = wel2
- local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
- local goal = {}
- goal.C0 = CFrame.new(-0.125,0,-(3.25 * 0.25)) * CFrame.Angles(0,math.rad(179),0)
- local doort2 = tweenService:Create(object, tweenInfo, goal)
- local goal = {}
- goal.C0 = CFrame.new(0,0,-(3.25 * 0.25)) * CFrame.Angles(0,math.rad(0.5),0)
- local doort4 = tweenService:Create(object, tweenInfo, goal)
- doort:Play()
- doort2:Play()
- PhysicsService:SetPartCollisionGroup(door1, car)
- PhysicsService:SetPartCollisionGroup(door2, car)
- local prox = Instance.new("ProximityPrompt",vseat)
- prox.RequiresLineOfSight = false
- prox.KeyboardKeyCode = Enum.KeyCode.E
- prox.Style = Enum.ProximityPromptStyle.Custom
- mod = nil
- off = true
- local open = true
- local doorplay = true
- doort.Completed:Connect(function()
- doorplay = false
- end)
- doort3.Completed:Connect(function()
- doorplay = false
- end)
- prox.Triggered:Connect(function(player)
- if player.Character == mod then
- if not doorplay and open then
- doorplay = true
- open = false
- doort3:Play()
- doort4:Play()
- elseif not doorplay and not open then
- doorplay = true
- open = true
- doort:Play()
- doort2:Play()
- end
- end
- end)
- local part30 = Instance.new("Part",part)
- part30.CanCollide = false
- part30.Transparency = 1
- local ats = Instance.new("Attachment",part)
- ats.CFrame = CFrame.new(-4,0,-9) * CFrame.Angles(0,0,math.rad(90))
- local ats2 = Instance.new("Attachment",part29)
- ats2.CFrame = CFrame.Angles(0,0,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
- part30.Transparency = 1
- local ats3 = Instance.new("Attachment",part)
- ats3.CFrame = CFrame.new(4,0,-9) * CFrame.Angles(0,0,math.rad(90))
- local ats4 = Instance.new("Attachment",part30)
- ats4.CFrame = CFrame.Angles(0,0,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
- local atl = Instance.new("Attachment",part30)
- local atl2 = Instance.new("Attachment",wheel2)
- local mot1 = Instance.new("HingeConstraint")
- mot1.Parent = part
- mot1.Attachment0 = atl
- mot1.Attachment1 = atl2
- local atl3 = Instance.new("Attachment",part)
- atl3.CFrame = CFrame.new(4,0,6.5)
- local atl4 = Instance.new("Attachment",wheel)
- local mot2 = Instance.new("HingeConstraint")
- wheel.CFrame = atl4.WorldCFrame
- mot2.Parent = part
- mot2.ActuatorType = "Motor"
- mot2.MotorMaxAcceleration = math.huge-1
- mot2.MotorMaxTorque = math.huge-1
- mot2.Attachment0 = atl3
- mot2.Attachment1 = atl4
- local atl5 = Instance.new("Attachment",part29)
- local atl6 = Instance.new("Attachment",wheel3)
- atl5.CFrame = atl5.CFrame * CFrame.Angles(0,math.rad(180),0)
- wheel3.CFrame = atl6.WorldCFrame
- local mot3 = Instance.new("HingeConstraint")
- mot3.Parent = part
- mot3.Attachment0 = atl5
- mot3.Attachment1 = atl6
- local atl7 = Instance.new("Attachment",part)
- atl7.CFrame = CFrame.new(-4,0,6.5)
- local atl8 = Instance.new("Attachment",wheel4)
- atl7.CFrame = atl7.CFrame * CFrame.Angles(0,math.rad(180),0)
- wheel4.CFrame = atl8.WorldCFrame
- local mot4 = Instance.new("HingeConstraint")
- mot4.Parent = part
- mot4.ActuatorType = "Motor"
- mot4.MotorMaxAcceleration = math.huge-1
- mot4.MotorMaxTorque = math.huge-1
- mot4.Attachment0 = atl7
- mot4.Attachment1 = atl8
- wait()
- part.Anchored = false
- wheel.Anchored = false
- wheel2.Anchored = false
- wheel3.Anchored = false
- wheel4.Anchored = false
- local currentthrot = 0
- speed = 0
- local hittab = {}
- par.Touched:Connect(function(wha)
- if (wha.Anchored == true or (wha:GetMass() > 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
- speed = 0
- elseif (wha.Anchored == true or (wha:GetMass() > 250 and wha:GetMass() < 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
- speed = speed * 0.5
- elseif wha.Anchored == false and speed > 5 then
- if wha:FindFirstAncestorWhichIsA("Model") and wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") and not table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")) then
- table.insert(hittab,wha:FindFirstAncestorWhichIsA("Model"))
- wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health -= speed + 20
- wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Sit = true
- pcall(function()
- local rnd = Random.new()
- local bv = Instance.new("BodyVelocity", wha:FindFirstAncestorWhichIsA("Model").Head)
- bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
- bv.Velocity = (part.CFrame.lookVector * (50 + speed)) + Vector3.new(0, 50 + speed, 0)
- game:GetService("Debris"):AddItem(bv,task.wait(.05))
- task.wait(.05)
- bv.MaxForce = Vector3.new()
- bv.Velocity = Vector3.new()
- wha:FindFirstAncestorWhichIsA("Model").Head.RotVelocity = Vector3.new(rnd:NextNumber(-5, 5), rnd:NextNumber(-5, 5), rnd:NextNumber(-5, 5))
- end)
- delay(2,function()
- table.remove(hittab,table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")))
- end)
- end
- end
- end)
- par7.Touched:Connect(function(wha)
- if (wha.Anchored == true or (wha:GetMass() > 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
- speed = 0
- elseif wha.Anchored == false and speed > 5 then
- if wha:FindFirstAncestorWhichIsA("Model") and wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") and not table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")) then
- table.insert(hittab,wha:FindFirstAncestorWhichIsA("Model"))
- wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health -= speed + 20
- wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Sit = true
- delay(2,function()
- table.remove(hittab,table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")))
- end)
- end
- end
- end)
- local function carMove(property)
- if property == "ThrottleFloat" then
- if vseat.ThrottleFloat ~= 0 then
- currentthrot = vseat.ThrottleFloat
- throt = true
- else
- currentthrot = 0
- throt = false
- end
- elseif property == "Occupant" then
- pcall(function()
- if vseat.Occupant ~= nil then
- if vseat.Occupant:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Bus Key") or game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")).Backpack:FindFirstChild("Bus Key") then
- mod = vseat.Occupant:FindFirstAncestorWhichIsA("Model")
- off = false
- coroutine.wrap(function()
- for i = 1,5 do
- sound.Volume = math.clamp(sound.Volume + 0.4,0,20)
- game:GetService("RunService").Heartbeat:Wait()
- end
- end)()
- part:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")))
- vseat:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")))
- else
- mod = nil
- off = true
- coroutine.wrap(function()
- for i = 1,5 do
- sound.Volume = 0
- game:GetService("RunService").Heartbeat:Wait()
- end
- end)()
- part:SetNetworkOwner(owner)
- vseat:SetNetworkOwner(owner)
- end
- else
- mod = nil
- off = true
- coroutine.wrap(function()
- for i = 1,5 do
- sound.Volume = 0
- game:GetService("RunService").Heartbeat:Wait()
- end
- end)()
- part:SetNetworkOwner(owner)
- vseat:SetNetworkOwner(owner)
- end
- end)
- end
- end
- lastthrot = 0
- vseat.Changed:Connect(carMove)
- coroutine.wrap(function()
- while game:GetService("RunService").Heartbeat:Wait() do
- if not off and gas ~= 0 then
- steer.TargetAngle = 35 * -vseat.SteerFloat
- steer2.TargetAngle = 35 * -vseat.SteerFloat
- wel4.C0 = wel4.C0:lerp(CFrame.Angles(0,0,math.rad(70 * vseat.SteerFloat)),0.15)
- gas = math.clamp(gas - 1,0,3000)
- else
- steer.TargetAngle = 12.5 * -vseat.SteerFloat
- steer2.TargetAngle = 12.5 * -vseat.SteerFloat
- wel4.C0 = wel4.C0:lerp(CFrame.Angles(0,0,math.rad(25 * vseat.SteerFloat)),0.15)
- end
- end
- end)()
- local reverse = false
- while game:GetService("RunService").Heartbeat:Wait() do
- if throt and math.clamp(currentthrot * math.huge,-1,1) ~= -lastthrot and not off and gas ~= 0 then
- lastthrot = vseat.Throttle
- bigbrakes:Stop()
- game:GetService("RunService").Heartbeat:Wait(0.0525)
- speed = math.clamp(speed + (0.75 * 0.25),0,30)
- sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
- mot2.AngularVelocity = vseat.ThrottleFloat * -(speed - (vseat.SteerFloat))
- mot4.AngularVelocity = -vseat.ThrottleFloat * -(speed + (vseat.SteerFloat))
- elseif throt and math.clamp(currentthrot * math.huge,-1,1) == -lastthrot and not off and gas ~= 0 then
- brakes.Volume = 1
- brakes:Play()
- sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
- for i = 1, 35 do
- game:GetService("RunService").Heartbeat:Wait(0.0525)
- speed = math.clamp(speed - (1 * 0.5),0,25)
- mot2.AngularVelocity = lastthrot * -(speed - (vseat.SteerFloat))
- mot4.AngularVelocity = -lastthrot * -(speed + (vseat.SteerFloat))
- if speed == 0 then
- lastthrot = vseat.Throttle
- bigbrakes:Stop()
- brakes.Volume = 0.5
- brakes:Play()
- if speed == 0 then break end
- end
- end
- elseif not throt or off or gas == 0 then
- if speed ~= 0 then
- game:GetService("RunService").Heartbeat:Wait(0.0325)
- else
- bigbrakes:Stop()
- end
- sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
- speed = math.clamp(speed - (0.75 * 0.5),0,30)
- mot2.AngularVelocity = lastthrot * -(speed)
- mot4.AngularVelocity = -lastthrot * -(speed)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement