Help with detecting inputs with cars

I’m trying to figure out how to detect multiple inputs for cars. I also want to repeatedly detect inputs so if you press another key it wont stop giving the input. I dont really know how to do this. I can detect user inputs. But only 1 at a time. And if you move your camera or something the input will stop. Here is some of my code:

ServerScript:

local CarInput = ReplicatedStorage:WaitForChild("CarInput")

local TweenService = game:GetService("TweenService")






CarInput.OnServerEvent:Connect(function(Player, key, SeatPart)
	

	
	

	
	
	if key == Enum.KeyCode.W then
		
		SeatPart.Parent.Base.Speed.Value = SeatPart.Parent.Base.Speed.Value + 2
		

			--for i=0, 1, 0.05 do
			--local NewCFrame = SeatPart.Parent.Base.CFrame * CFrame.new(0, 0.1, 0)	
				
				
				--SeatPart.Parent.Base.CFrame = SeatPart.Parent.Base.CFrame:Lerp(NewCFrame, i)	
				--wait()
			
		--end
		end
		
		if key == Enum.KeyCode.D then
			
			
			
			for i=0, 1, 0.2 do
				SeatPart.Parent.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0, -2, 0)
				wait()
				SeatPart.Parent.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
			end
			
		
	end
	
	if key == Enum.KeyCode.A then
		
		
		for i=0, 1, 0.2 do
			SeatPart.Parent.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 2, 0)
			wait()
			SeatPart.Parent.Base.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
		end
		
	end
	
	if key == Enum.KeyCode.S then
	
			SeatPart.Parent.Base.Speed.Value = SeatPart.Parent.Base.Speed.Value - 3
		
	--	for i=0, 1, 0.05 do
			--local NewCFrame = SeatPart.Parent.Base.CFrame * CFrame.new(0, 0.1, 0)	
			
			
			--SeatPart.Parent.Base.CFrame = SeatPart.Parent.Base.CFrame:Lerp(NewCFrame, i)	
			--wait()
			
			
		--end
		
	end
end)

Local Script:


local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CarInput = ReplicatedStorage:WaitForChild("CarInput")
local Character = game.Players.LocalPlayer.Character
local KeyPressed = false
local keyGlobal
print(Character)
UserInputService.InputBegan:Connect(function(key)
	KeyPressed = true
	keyGlobal = key
end)

UserInputService.InputEnded:Connect(function(key)
	KeyPressed = false
end)



while wait(0.1) do
	if Character.Humanoid.Sit then
		if Character.Humanoid.SeatPart.Name == "PlayerSeat" then
			if KeyPressed then
				CarInput:FireServer(keyGlobal.KeyCode, Character.Humanoid.SeatPart)
		print("Fired")
	end	
		end
		
	end	
end