if script.Parent.Parent.Parent.IsOn.Value then script.Parent.Parent:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end script.Parent.Parent.Parent.IsOn.Changed:connect(function()if script.Parent.Parent.Parent.IsOn.Value then script.Parent.Parent:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end end)script.Parent.MouseButton1Click:connect(function()if lhinge.DesiredAngle==0 then sound.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047\050\055\056\051\050\057\054\051\056"sound:Play()for S,z in pairs(car.Misc.Popups.left.Parts.L:GetChildren())do z.Material=Enum.Material.Neon end for S,z in pairs(car.Misc.Popups.right.Parts.L:GetChildren())do z.Material=Enum.Material.Neon end for S,z in pairs(car.Body.Lights.L:GetChildren())do z.Material=Enum.Material.Neon if z.Name==V then z.Transparency=0 end end car.Misc.Popups.left.Parts.L.L.L.Enabled=true car.Misc.Popups.right.Parts.L.L.L.Enabled=true wait(.05)lhinge.DesiredAngle=.6 rhinge.DesiredAngle=.6 else for S,z in pairs(car.Misc.Popups.left.Parts.L:GetChildren())do z.Material=Enum.Material.SmoothPlastic end for S,z in pairs(car.Misc.Popups.right.Parts.L:GetChildren())do z.Material=Enum.Material.SmoothPlastic end for S,z in pairs(car.Body.Lights.L:GetChildren())do z.Material=Enum.Material.SmoothPlastic if z.Name==V then z.Transparency=1 end end car.Misc.Popups.left.Parts.L.L.L.Enabled=false car.Misc.Popups.right.Parts.L.L.L.Enabled=false lhinge.DesiredAngle=0 rhinge.DesiredAngle=0 sound.SoundId="\114\098\120\097\115\115\101\116\105\100\058\047\047\050\055\056\051\050\057\054\051\056"sound:Play()end end)script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()if script.Parent.Parent.Parent.Values.Brake.Value~=1 then for S,z in pairs(car.Body.Lights.B:GetChildren())do z.Material=Enum.Material.SmoothPlastic z.Transparency=1 end car.Body.Lights.B.L.L.Enabled=false else for S,z in pairs(car.Body.Lights.B:GetChildren())do z.Material=Enum.Material.Neon z.Transparency=0 end car.Body.Lights.B.L.L.Enabled=true end end)script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()if script.Parent.Parent.Parent.Values.Gear.Value==-1 then for S,z in pairs(car.Body.Lights.Rev:GetChildren())do z.Material=Enum.Material.Neon car.DriveSeat.Reverse:Play()end else for S,z in pairs(car.Body.Lights.Rev:GetChildren())do z.Material=Enum.Material.SmoothPlastic car.DriveSeat.Reverse:Stop()end end end)while wait()do if car.DriveSeat.Velocity.magnitude/40+.3<1.3 then car.DriveSeat.Reverse.Pitch=car.DriveSeat.Velocity.magnitude/40+.3 car.DriveSeat.Reverse.Volume=car.DriveSeat.Velocity.magnitude/150 else car.DriveSeat.Reverse.Pitch=1.3 car.DriveSeat.Reverse.Volume=.5 end end
---
if script.Parent.Parent.Parent.IsOn.Value then
	script.Parent.Parent:TweenPosition(
		UDim2.new(0, 0, 0, 0),
		Enum.EasingDirection.InOut,
		Enum.EasingStyle.Quad,
		1,
		true
	)
end

script.Parent.Parent.Parent.IsOn.Changed:connect(function()
	if script.Parent.Parent.Parent.IsOn.Value then
		script.Parent.Parent:TweenPosition(
			UDim2.new(0, 0, 0, 0),
			Enum.EasingDirection.InOut,
			Enum.EasingStyle.Quad,
			1,
			true
		)
	end
end)

script.Parent.MouseButton1Click:connect(function()
	if lhinge.DesiredAngle == 0 then
		sound.SoundId = "rbxassetid://278329638"
		sound:Play()
		for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
			child.Material = Enum.Material.Neon
		end
		for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
			child.Material = Enum.Material.Neon
		end
		for index, child in pairs(car.Body.Lights.L:GetChildren()) do
			child.Material = Enum.Material.Neon
			if child.Name == V then --TESTING
				child.Transparency = 0 --TESTING
			end
		end
		car.Misc.Popups.left.Parts.L.L.L.Enabled = true
		car.Misc.Popups.right.Parts.L.L.L.Enabled = true
		wait(0.05)
		lhinge.DesiredAngle = 0.6
		rhinge.DesiredAngle = 0.6
	else
		for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
		end
		for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
		end
		for index, child in pairs(car.Body.Lights.L:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			if child.Name == V then --TESTING
				child.Transparency = 1 --TESTING
			end
		end
		car.Misc.Popups.left.Parts.L.L.L.Enabled = false
		car.Misc.Popups.right.Parts.L.L.L.Enabled = false
		lhinge.DesiredAngle = 0
		rhinge.DesiredAngle = 0
		sound.SoundId = "rbxassetid://278329638"
		sound:Play()
	end
end)

script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
	if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 then
		for index, child in pairs(car.Body.Lights.B:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			child.Transparency = 1
		end
		car.Body.Lights.B.L.L.Enabled = false
	else
		for index, child in pairs(car.Body.Lights.B:GetChildren()) do
			child.Material = Enum.Material.Neon
			child.Transparency = 0
		end
		car.Body.Lights.B.L.L.Enabled = true
	end
end)

script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
	if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
		for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.Neon
			car.DriveSeat.Reverse:Play()
		end
	else
		for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
			child.Material = Enum.Material.SmoothPlastic
			car.DriveSeat.Reverse:Stop()
		end
	end
end)

while wait() do
	if (car.DriveSeat.Velocity.magnitude / 40) + 0.300 < 1.3 then
		car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude / 40) + 0.300
		car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude / 150)
	else
		car.DriveSeat.Reverse.Pitch = 1.3
		car.DriveSeat.Reverse.Volume = 0.5
	end
end
