Hello, I am trying to make a toggle script for a car's headlights. For some reason, there is nothing happening if I press L. No errors in the console.
local toggle = false -- false is Off; true is On function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print("L was pressed") if toggle == false then toggle = true script.Parent.Enabled = true else toggle = false script.Parent.Enabled = false end end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.L)