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!
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!
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.
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
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.
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.
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)