Studio Settings saving command


I’m a guy who frequently cleans his pc, that means lot of files, uninstalling programms and in some cases resetting my pc, and that comes with the problem of getting my studio settings (specially script editor colors) lost everytime I do so. I came across SimplyRekt’s Script Editor Themes plugin but it wasn’t excactly what I was searching for, I just wanted something simple that could save my own settings and just that.

So meh, I’m not sure if there’s already a way of saving settings neither if some roblox engineer is working on a feature to do so but I decided to make an executable script that works as a command to generate a save script with your settings


How to use

To use this script you just have to copy-paste it into the roblox command bar and execute the command. If you have other plugins like InCommand that allow for script execution you can also use them.

Once the command is executed a .lua file (in form of a Script) will appear in the explorer tab under the Lighting tab, that script contains a dictionary containing your saved settings and a little function that uses the values found in the dictionary to stablish your studio settings.

Once you have that script you can execute it to get your saved settings applied to studio, if you prefer to do so you can save the script as a Plugin or Local Plugin and the script will automatically set up itself as a plugin with a button that can be pressed to get back your settings.

local Studio = settings().Studio

local SettingsSave = {

	-- To add a new setting go to the bottom of the list and add a new key:
	-- ["Setting Name"] = Studio["Setting Name"]

	--> Script Editor:
	
	["TODO Color"] = Studio['"TODO" Color'],
	["self Color"] = Studio['"self" Color'],
	["local Color"] = Studio['"local" Color'],
	["function Color"] = Studio['"function" Color'],
	["nil Color"] = Studio['"nil" Color'],
	["Text Color"] = Studio["Text Color"],
	["Background Color"] = Studio["Background Color"],
	["Selection Color"] = Studio["Selection Color"],
	["Selection Background Color"] = Studio["Selection Background Color"],
	["Operator Color"] = Studio["Operator Color"],
	["Number Color"] = Studio["Number Color"],
	["String Color"] = Studio["String Color"],
	["Comment Color"] = Studio["Comment Color"],
	["Keyword Color"] = Studio["Keyword Color"],
	["Error Color"] = Studio["Error Color"],
	["Warning Color"] = Studio["Warning Color"],
	["Find Selection Background Color"] = Studio["Find Selection Background Color"],
	["Matching Word Background Color"] = Studio["Matching Word Background Color"],
	["Built-in Function Color"] = Studio["Built-in Function Color"],
	["Whitespace Color"] = Studio["Whitespace Color"],
	["Current Line Highlight Color"] = Studio["Current Line Highlight Color"],
	["Debugger Current Line Color"] = Studio["Debugger Current Line Color"],
	["Debugger Error Line Color"] = Studio["Debugger Error Line Color"],
	["Method Color"] = Studio["Method Color"],
	["Property Color"] = Studio["Property Color"],
	["Bool Color"] = Studio["Bool Color"],
	["Luau Keyword Color"] = Studio["Luau Keyword Color"],
	["Ruler Color"] = Studio["Ruler Color"],
	["Bracket Color"] = Studio["Bracket Color"],
	
	["Auto Closing Brackets"] = Studio["Auto Closing Brackets"],
	["Auto Closing Quotes"] = Studio["Auto Closing Quotes"],
	["Skip Closing Brackets and Quotes"] = Studio["Skip Closing Brackets and Quotes"],
	["Auto Clean Empty Line"] = Studio["Auto Clean Empty Line"], 
	["Enable Autocomplete"] = Studio["Enable Autocomplete"],
	["Highlight Current Line"] = Studio["Highlight Current Line"],
	["Highlight Occurances"] = Studio["Highlight Occurances"],
	["Enable Temporary Tabs"] = Studio["Enable Temporary Tabs"],
	["Enable Temporary Tabs In Explorer"] = Studio["Enable Temporary Tabs In Explorer"],
	["Format On Type"] = Studio["Format On Type"],
	["Format On Paste"] = Studio["Format On Paste"],
	["Scroll Past Last Line"] = Studio["Scroll Past Last Line"],
	["Text Wrapping"] = Studio["Text Wrapping"],
	["Indent Using Spaces"] = Studio["Indent Using Spaces"],
	["Show Whitespace"] = Studio["Show Whitespace"],
	
	--> Tools:
	
	["Active Color"] = Studio["Active Color"],
	["Select Color"] = Studio["Select Color"],
	["Hover Over Color"] = Studio["Hover Over Color"],
	["Active Hover Over Color"] = Studio["Active Hover Over Color"],
	["Show Hover Over"] = Studio["Show Hover Over"],
	["Animate Hover Over"] = Studio["Animate Hover Over"],
	
	--> PrimaryPart:
	
	["Select/Hover Color"] = Studio["Select/Hover Color"],
	["Line Thickness"] = Studio["Line Thickness"],
	
	--> Camera:
	
	["Camera Speed"] = Studio["Camera Speed"],
	["Camera Shift Speed"] = Studio["Camera Shift Speed"],
	["Camera Mouse Wheel Speed"] = Studio["Camera Mouse Wheel Speed"],
	["Camera Zoom to Mouse Position"] = Studio["Camera Zoom to Mouse Position"],
	
	--> Advanced:
	
	["Show Diagnostics Bar"] = Studio["Show Diagnostics Bar"],
	["Respect Studio shortcuts when game has focus"] = Studio["Respect Studio shortcuts when game has focus"],
	["Drag Multiple Parts As Single Part"] = Studio["Drag Multiple Parts As Single Part"],
	["Show QT warnings in output"] = Studio["Show QT warnings in output"],
	
	--> Explorer:
	
	["Show Hidden Objects in Explorer"] = Studio["Show Hidden Objects in Explorer"],
	["Show Plugin GUI Service in Explorer"] = Studio["Show Plugin GUI Service in Explorer"],
	["Show Core GUI in Explorer while Playing"] = Studio["Show Core GUI in Explorer while Playing"],
	["Show plus button on hover in Explorer"] = Studio["Show plus button on hover in Explorer"],
}

local dictionaryToString = ""

for setting, value in pairs(SettingsSave) do
	if (type(value) == "number") then
		dictionaryToString = dictionaryToString .. '["' .. setting .. '"]' .. " = " .. tostring(value) .. ",\n"
	elseif (type(value) == "boolean") then
		if (value == true) then
			dictionaryToString = dictionaryToString .. '["' .. setting .. '"]' .. " = true,\n"
		else
			dictionaryToString = dictionaryToString .. '["' .. setting .. '"]' .. " = false,\n"
		end
	else
		dictionaryToString = dictionaryToString .. '["' .. setting .. '"]' .. " = Color3.new(" .. tostring(value) .. "),\n"
	end
end

local dictionary = 'local SavedSettings = {\n' .. dictionaryToString .. '}\n'

local src = dictionary .. [[

-->> Services:

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local RunService = game:GetService("RunService")

--: Prevent the script from executing if it is out-of-studio

if (not RunService:IsStudio()) then
	return 
end

-->> Constants

local Studio = settings().Studio

-->> Functions

local function ApplySavedSettings()
	ChangeHistoryService:SetWaypoint("Applying Saved Settings") --: In case you want to undo your actions
	
	for setting, value in pairs(SavedSettings) do

	--: Due to the way strings work I couldn't write '"nil" Color' since it would break
	--: the dictionary so I had to write the nil, self, local, function and TODO setting names
	--: without the quotation marks and check them sepparately.

		if (setting == "nil Color") then
			Studio['"nil" Color'] = value
		elseif (setting == "self Color") then
			Studio['"self" Color'] = value
		elseif (setting == "TODO Color") then
			Studio['"TODO" Color'] = value
		elseif (setting == "local Color") then
			Studio['"local" Color'] = value
		elseif (setting == "function Color") then
			Studio['"function" Color'] = value
		else
			Studio[setting] = value
		end
	end
	
	ChangeHistoryService:SetWaypoint("Applied Saved Settings")
	
	print("Applied saved settings to Studio!")
end

--: Prevent the plugin from automatically firing if it is a plugin, creating a button to fire the script instead.

if (plugin ~= nil) then
	local toolbar = plugin:CreateToolbar("Studio Settings Saver")
	local button0 = toolbar:CreateButton(
		"apply_saved_settings",
		"Apply your saved settings", 
		"rbxassetid://7120056463",
		"Apply"
	)
	
	button0.Click:Connect(ApplySavedSettings)
	button0:SetActive(false)
else
	ApplySavedSettings()
end

]]
		
local newScript = Instance.new("Script")
newScript.Name = "SavedSettings"
newScript.Source = src
newScript.Parent = game:GetService("Lighting") 

--: The new script is parented to lighting since it tends to be a place where you can find instances easily
3 Likes

I think this should be in #resources:community-resources

1 Like

Yeah maybe, but as I said I don’t really know if this is already in-roblox or if there’s other plugin that does this better so I’m not sure how much could this help.