'CoreGUI' is not a valid Service name?

  1. I’m trying to make a simple gui plugin

  2. The issue is that it is supposed to insert the gui into “CoreGUI” but it is unable to find it and I am getting this error: “‘CoreGUI’ is not a valid Service name. I am a beginner on plugins but my whole process is: Inserting script into ServerScriptService > Writing the Code > Inserting GUI under the Script > Then saving as local plugin.”

  3. I can’t find any solutions of the Developer Hub.

local openGuiButton = toolbar:CreateButton("Create Scripts", "Test", "")
local gui = script:FindFirstChildOfClass("ScreenGui")
local coreGui = game:GetService("CoreGUI")

openGuiButton.Click:Connect(function()
	if gui.Parent == script then
		gui.Parent = coreGui
	end
end)

The service is capitalized as CoreGui which means that if you update CoreGUI to CoreGui, it should retrieve the service as intended.

2 Likes

This worked but now it says: user_PluginTest.lua.Script:7: attempt to index nil with ‘Parent’

Line 7 : if gui.Parent == script then

That’s saying that gui is nil, which means that it did not find a ScreenGui within the Script:

Actually I fixed it. It seems that when I put it into a folder instead of making the GUI the child of the script and instead putting both into a folder it works. and I edited the script to say:
gui = script.Parent.PluginGUI
Dunno why this works but it does

1 Like

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