im following the guide on plugins: Plugins | Documentation - Roblox Creator Hub
ive copied the script and ive added the recording beginning and end
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local Selection = game:GetService("Selection")
-- Create a new toolbar section titled "Custom Script Tools"
local toolbar = plugin:CreateToolbar("Custom Script Tools")
-- Add a toolbar button named "Create Empty Script"
local newScriptButton = toolbar:CreateButton("Create Empty Script", "im over here strokin my gut i got gravy on my gut im gluttonous as hell man im an ogre man", "rbxassetid://14978048121")
-- Make button clickable even if 3D viewport is hidden
newScriptButton.ClickableWhenViewportHidden = true
local function onNewScriptButtonClicked()
local recording = ChangeHistoryService:TryBeginRecording("add script")
if not recording then
warn("uh oh!!!")
return
end
local selectedObjects = Selection:Get()
local parent = game:GetService("ServerScriptService")
if #selectedObjects > 0 then
parent = selectedObjects[1]
end
local newScript = Instance.new("Script")
newScript.Source = ""
newScript.Parent = parent
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
end
newScriptButton.Click:Connect(onNewScriptButtonClicked)
apparently there’s already a recording happening since the warning always appears and the recording variable is always nil. how do i cancel this invisible recording? or if ive made some mistake, what did i do wrong?