How do I make these ELS's toggleable

The tutorial I watched showed me how to do the lights just not the Press J to toggle them. Help me please


Think this is a question for scripting support right?

Whoops yeah. Can you help me make the ELS (Emergency Light System) toggleable?

We can’t help you without seeing your script.

well
i’ll get back whenever I can. Please wait

Here is a possible way you could accomplish you’re goal. It uses a local script in StarterPlayerScripts, a remote event in ReplicatedStorage, and a script in ServerScriptService. This is a very basic template, add the light turning on stuff inside the script where the print line is. (Forgot to add the toggle part whoops)

local script

local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.RemoteEvent

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	
	if input.KeyCode == Enum.KeyCode.J then
		
		Remote:FireServer()
		
	end
	
end)

script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.RemoteEvent
local Toggle = false


function ELStoggle()
	
	if Toggle == false then
		
		print("Lights on")
		
		Toggle = true
		
	else
		
		print("Lights off")
		
		Toggle = false
		
	end
	
end

Remote.OnServerEvent:Connect(ELStoggle)