Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scriptHolder = workspace:FindFirstChild("Scripts") or workspace:FindFirstChild("! Scripts")
- if not scriptHolder then
- scriptHolder = game:GetService("Selection"):Get()[1]
- end
- if not scriptHolder or not scriptHolder:IsDescendantOf(workspace) then
- error("Select something first!", 2)
- end
- print("Loading scripts from "..scriptHolder:getFullName().."...")
- local function makeAndOverwrite(parent, name, class)
- if parent:findFirstChild(name) then
- parent[name]:remove()
- end
- local ret = Instance.new(class, parent)
- ret.Name = name
- return ret
- end
- local target = makeAndOverwrite(game.Lighting, "Scripts", "Model")
- local loaderSource = "--AutoGenerated reseource loading script\nlocal s = game.Lighting.Scripts"
- for _, script in ipairs(scriptHolder:GetChildren()) do
- local stringValue = Instance.new("StringValue", target)
- stringValue.Name = script.Name
- stringValue.Value = script.Source
- loaderSource = loaderSource .."\nloadstring(s."..script.Name..".Value)()"
- end
- makeAndOverwrite(game.StarterPack, "LoaderScript", "LocalScript").Source = loaderSource
- makeAndOverwrite(game.Workspace, "LoaderScript", "Script").Source = loaderSource
Advertisement
Add Comment
Please, Sign In to add comment