Error: ServerScriptService.Script:5: attempt to index nil with ‘CreateToolbar’ - Server - Script:5
(This is my first attempt at making a plugin so I don’t really know what I’m doing)
local selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Easy Tweening")
local openGuiButton = toolbar:CreateButton("Tween", "Begin", "rbxassetid://15537143749")
local gui = script:WaitForChild("TweenPluginUI", 10)
openGuiButton.Click:Connect(function()
if gui.Parent == script then
gui.Parent = game:WaitForChild("CoreGui")
elseif gui.Parent == game:WaitForChild("CoreGui") then
gui.Parent = script
end
end)
gui.Main.InsertButton.MouseButton1Click:Connect(function()
print(selection.Name)
end)
1 Like
msix29
(msix29)
December 3, 2023, 5:25pm
2
Are you running the game? You need to save the plugin as local plugin for it to actually run.
2 Likes
I tried running the game, yes. It doesn’t work in studio or in-game.
Idk how to make it a local plugin. Like I said, I really have no clue what I’m doing. Could you walk me through the steps please?
msix29
(msix29)
December 3, 2023, 5:32pm
4
You shouldn’t run the game. Right click the script/folder of the plugin, click “Save as Local Plugin” and give it a name (or just click enter) and it should run after.
1 Like
Okay, that works, thanks!
But now I’m getting different errors…
user_TweenPlugin.lua.Script:16: attempt to index nil with ‘Main’ - Edit
user_TweenPlugin.lua.Script:9: attempt to index nil with ‘Parent’
local selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Easy Tweening")
local openGuiButton = toolbar:CreateButton("Tween", "Begin", "rbxassetid://15537143749")
local gui = script:WaitForChild("TweenPluginUI", 10)
openGuiButton.Click:Connect(function()
if gui.Parent == script then
gui.Parent = game:WaitForChild("CoreGui")
elseif gui.Parent == game:WaitForChild("CoreGui") then
gui.Parent = script
end
end)
gui.Main.InsertButton.MouseButton1Click:Connect(function()
print(selection.Name)
end)
msix29
(msix29)
December 3, 2023, 5:41pm
6
Your probably using a script for your plugin, scripts are saved alone and so, can’t access UIs under them. To use the UI create a folder (with the same name as the plugin) and move the script (with everything else) inside it. That’ll fix it.
1 Like
Still getting the same error. Maybe I’m overlooking something…
user_TweenPlugin.lua.Script:9: attempt to index nil with ‘Parent’
Paths:
ServerScriptService → Tween (Folder) → TweenPlugin (Script)
ServerScriptService → Tween (Folder) → TweenPluginUI (ScreenGui) → Main (Frame) → InsertButton (TextButton)
Updated script:
local selection = game:GetService("Selection")
local toolbar = plugin:CreateToolbar("Easy Tweening")
local openGuiButton = toolbar:CreateButton("Tween", "Begin", "rbxassetid://15537143749")
local gui = script.Parent:WaitForChild("TweenPluginUI")
openGuiButton.Click:Connect(function()
if gui.Parent == "Tween" then
gui.Parent = game:WaitForChild("CoreGui")
elseif gui.Parent == game:WaitForChild("CoreGui") then
gui.Parent = script
end
end)
gui.Main.InsertButton.MouseButton1Click:Connect(function()
print(selection.Name)
end)
msix29
(msix29)
December 3, 2023, 5:50pm
8
Did u save the folder again? Make sure to save the folder not the script.
I did, but I’ll try again. Does the name of the plugin matter?
msix29
(msix29)
December 3, 2023, 5:53pm
10
No it doesn’t, just make sure you delete the old one so you don’t get false errors.
1 Like
Thanks for your help!
(filler text for character limit)
system
(system)
Closed
December 17, 2023, 6:00pm
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.