Default Scripter - Optimize your scripting experience

Hello everyone, today I decided to make something a bit cool to save time on scripting (literal nanoseconds)

When you insert a script it’s no longer just print(“Hello World!”), it replaces that with a new better default script and copyrights it with your name!

Heres the link to the plugin : Default Scripter - Creator Store (roblox.com) (WORKING)

Screenshots :
Server Script :
image
Local script :
image
Module Script :


Source code :

local RunService = game:GetService("RunService")
local StudioService = game:GetService("StudioService")
local Players = game:GetService("Players")

if not RunService:IsRunning() and RunService:IsStudio() then
	local UserId = StudioService:GetUserId()
	local Name = Players:GetNameFromUserIdAsync(UserId)
	
	local Default = `--!strict\n--!native\n--!optimize 2\n-- // Copyright {os.date("*t").year}, {Name}, All rights reserved.`
	
	local WhitelistedParents = {
		[game.Players] = true,
		[game.Workspace] = true,
		[game.Lighting] = true,
		[game.MaterialService] = true,
		[game.NetworkClient] = true,
		[game.ReplicatedFirst] = true,
		[game.ReplicatedStorage] = true,
		[game.ServerScriptService] = true,
		[game.ServerStorage] = true,
		[game.StarterGui] = true,
		[game.StarterPack] = true,
		[game.StarterPlayer] = true,
		[game.Teams] = true,
		[game.SoundService] = true,
		[game.TextChatService] = true,
	}
	
	local Whitelist = {
		[script:WaitForChild("Script").Source] = true,
		[script:WaitForChild("ModuleScript").Source] = true,
	}
	
	local Sources = {
		["Script"] = Default,
		["LocalScript"] = Default,
		["ModuleScript"] = Default.."\n\nlocal Module = {}\n\nfunction Module:Setup()\n\nend\n\nreturn Module",
	}

	game.DescendantAdded:Connect(function(Descendant)
		local Source = Sources[Descendant.ClassName]
		
		if not Source then return end
		
		local Parent = Descendant

		while Parent ~= nil do
			if WhitelistedParents[Parent] then break end

			Parent = Parent.Parent
		end

		if not WhitelistedParents[Parent] then return end
		
		if not Whitelist[Descendant.Source] then
			return 
		end

		Descendant.Source = Source
	end)
end

MAKE SURE THERE IS A SCRIPT AND A MODULE SCRIPT INSIDE THE SCRIPT AND THIS IS PUT INTO A FOLDER IF YOU ARE GOING TO SAVE THIS AS A LOCAL PLUGIN!

8 Likes

I’ll be adding more to the plugin once I come back home, like checking if the Year on the copyrighted scripts are outdated.

3 Likes

Mmm… what if I insert a model of mine (or any other) from the Toolbox that contains important scripts? Those would get wiped out.

5 Likes

you don’t need optimize 2, as that only does anything inside studio. unless you’re squeezing out performance for benchmarking, i would argue it’s useless.

the copyright is also not protecting any of your code.

native also doesn’t work on local scripts. native mode also shouldn’t be used for every script. it should only be on scripts that do a ton of native operations. if you put it on every script you’re only increasing memory for a gamble of optimization.

plugins only work in studio, so this idea is not a simple patch.

also, the objects you insert (which i feel like is bad practice, just parent it to serverstorage) will have their code compiled immediately anyways, meaning changing its source to then have native mode on makes no sense.

4 Likes

Hmm I’ll think about a fix for that later

3 Likes

Hey there, thanks for the feedback.

So optimize 2 only disabled some debugging features or stuff like that? I mean, I’m not against squeezing out perfomance for benchmarking if that’s the case

:person_shrugging: I’m no legal expert but I’ve seen some people do it so I thought I might as well add it to this plugin (Owner’s fault if they give some random TC)

Thanks for letting me know, mind giving me a link where I can found out more on that/you tell me maybe?

I don’t understand this part, this plugin is supposed to work only when you are editing the game, not playtesting.

3 Likes

image

4 Likes

Hi, thanks for telling me, but when I went to the configure page to make it free it doesn’t let me for some reason.
image

1 Like

Hey there everyone, looks like I can’t upload plugins if I’m not a US citizen or something, I guess the only choice right now is to save the script i included in the post as a local plugin.

1 Like

NEW UPDATE!

  • Fixed script inserted from toolbox/from other places being changed and the script source being lost.
  • Fixed the plugin breaking other plugins (possibly) by checking if they are inside of a whitelisted parent.
  • Fixed the plugin not working in local places due to there being no LocalPlayer.

Check the main post for the script (I can’t distribute plugins on the marketplace)

1 Like

Minor update, I optimized the plugin a bit so it checks the parent only if its a script or a module script (local script aswell)

2 Likes

Check to see if your plugin was removed by Roblox’s moderation. They are being very stringent these days and false removals on assets are nowadays commonplace. I don’t think Roblox would prevent you from uploading plugins for not being American (they only did that with paid plugins)

1 Like

Hey there everyone, I fixed the plugin link now it works completely fine! (adblock was breaking it)

1 Like