How to make my plugin save .lua files instead of .rbxm

How do i make my plugin save files as .lua instead of .rbxm.
there isnt a lot on plugin:saveselection

here is my code

local toolbar = plugin:CreateToolbar("Notes Buddy 1.0")
local button = toolbar:CreateButton("Notes_Buddy1.0/notes", "Want to write some notes?", "")

local widgetinfo = DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Float,
	false,
	false,
	400,
	700,
	400,
	700
)

local DockWidgetGUI = plugin:CreateDockWidgetPluginGui("Notes Buddy 1.0", widgetinfo)
DockWidgetGUI.Title = "Notes Buddy 1.0"

button.Click:Connect(function()
	DockWidgetGUI.Enabled = not DockWidgetGUI.Enabled
end)

local frame = script.Frame
local ActualFrame = frame.Frame
local TypeBOX = ActualFrame.TypeBOX
local ITALIC = ActualFrame.Italic
local bold = ActualFrame.BoldButton
local minus = ActualFrame.Minus
local save = ActualFrame.Save
local plus = ActualFrame.Plus

local selection = game:GetService("Selection")

function OnSave()
	local newscript = Instance.new("Script")
	local str = TypeBOX.Text
	newscript.Source = str
	selection:Set({newscript})
	plugin:PromptSaveSelection("NotesBuddy1")
end

save.MouseButton1Click:Connect(OnSave)
local fontsframe = ActualFrame.FontsFrame
local Gotham = fontsframe.GOTHAM
local SSP = fontsframe.SSP
local CODE = fontsframe.Code

CODE.MouseButton1Click:Connect(function()
	TypeBOX.Font = Enum.Font.Code
end)

SSP.MouseButton1Click:Connect(function()
	TypeBOX.Font = Enum.Font.SourceSans
end)

Gotham.MouseButton1Click:Connect(function()
	TypeBOX.Font = Enum.Font.Gotham
end)

minus.MouseButton1Click:Connect(function()
	TypeBOX.TextSize -= 1
end)

plus.MouseButton1Click:Connect(function()
	TypeBOX.TextSize += 1
end)

script.Frame.Parent = DockWidgetGUI
2 Likes

Just did some testing, apparently you need to parent the script somewhere first before saving so studio can automatically switch it to a .lua file.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.