Working on a plugin which saves what you type (It's a notepad plugin)
local dockWidget = plugin:CreateDockWidgetPluginGui ( "Notepad - FernandoMacLeod", DockWidgetPluginGuiInfo.new ( Enum.InitialDockState.Float, true, true, 300, 200, 150, 100 ) ) local ui = script:WaitForChild("UI") local container = ui:WaitForChild("Container") local body = container:WaitForChild("Body") local notepad = body:WaitForChild("Notepad") local errorLabel = body:WaitForChild("Error") local success = body:WaitForChild("Success") local savedText = "" function save () plugin:SetSetting("Notepad" .. tostring(game.GameId), notepad.Text) end notepad.Parent = dockWidget dockWidget.Title = "Notepad" while (game.GameId == 0) do wait(0.3) end savedText = plugin:GetSetting("Notepad" .. tostring(game.GameId)) or "" errorLabel.Visible = true notepad.FocusLost:Connect( save )
Never had this error before whilst testing a plugin. I've tried to look at other threads to do with this issue, but to no avail.
Line causing the error:
local interface = script:WaitForChild("UI")
This seems to be a new problem that various users have experienced recently (including myself). Instead of accessing objects through the keyword script
, you now must use the keyword plugin
instead and retrieve objects from there. For example, if you upload the script as the plugin with the objects inside, you can go:
local ui = plugin["ScriptNameHere"].UI
to retrieve the UI. However, for a more organised layout, I would recommend uploading a folder as the plugin with the script and the rest of the contents inside, so you don't have to go through the script to get everything, although it should work fine either way.