How would I make a command work both ways?

I made a command which grayscales the world once typed in chat, I want it to be able to disable and enable with the same command, how would I go about doing this?

local tool = script.Parent.Parent
local keyword = "/e grayscale" -- Keyword Here

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if (msg == keyword and player.UserId == AdminIDS) then
			game.Lighting.Grayscale.Enabled = true --Do Stuff Here
		elseif game.Lighting.Grayscale.Enabled == true then game.Lighting.Grayscale.Enabled = false
		end
	end)
end)
local tool = script.Parent.Parent
local keyword = "/e grayscale" -- Keyword Here

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if (msg == keyword and player.UserId == AdminIDS) then
			game.Lighting.Grayscale.Enabled = not game.Lighting.Grayscale.Enabled -- Changes the true to false and false to true
		end
	end)
end)
1 Like