--== Primary logic ==--

modifierPressed 	= false
primaryPressed 	= false
debouncer 			= false

inputService.InputChanged:connect(function(winput,processed)
	if processed == false then -- checks to see if you're focused on a textbox or not
		local pressedkeys = inputService:GetKeysPressed()
		
		for _, input in pairs (pressedkeys) do -- iterate all keys currently pressed
			if input.KeyCode == modifierKey then
				modifierPressed = true
			end
			if input.KeyCode == primaryKey then
				primaryPressed = true
			end
			if primaryPressed and modifierPressed then break end -- escapes loop
		end
		
		if primaryPressed == true and modifierPressed == true and debouncer == false then
			debouncer 			= true
			if script.Parent.IsOn.Value == false then StartCar() else StopCar() end
			primaryPressed 	= false
			modifierPressed	= false
			wait(2)
			debouncer = false
		end
	end
end)

script.Parent.IsOn.Changed:Connect(function()
	script.Parent.IgnitionStatus.Text = script.Parent.IsOn.Value and "Engine On" or "Engine Off"
end)
