I am making a DOT (Department of transportation) ford f350, the lights flash but I ney a keybind for on/off lighting, but i have no idea where to put it I know the script Enum.KeyCode.(button)
Before you connect this code, make sure that the player is actually in the car, else they'll be able to turn the lights on/off even if they're not driving. This should also go in a local script. This script also assumes that you have a function for turning the lights on and off. Didn't test this so watch out for spelling mistakes.
local UIS = game:GetService("UserInputService") local LightsAreOn = false UIS.InputBegan:Connect(function(Input, GSE) if Input.Keycode = Enum.KeyCode.J then if LightsAreOn then LightsOn() LightsAreOn = true else LightsOff() LightsAreOn = false end end end)