I’m trying to make a plugin, but my script to open a gui isn’t working. I have a script in ServerScriptService, and the gui I want to appear is in the script. I keep getting an error that says: user_Plugin.lua.Script:15: attempt to index nil with ‘Parent’
Here is the part of the script that seems to be causing this error:

Your error is saying that on the line where you do gui.Parent = ...
, you are indexing nil
with Parent
, which means that gui
is nil
. This means that it was never a child of the script, in the 10 seconds that the WaitForChild()
function waited.
On another note, you cannot set instances’ parents to CoreGui, as that is something used by Roblox’s built-in UI. You must instead use PlayerGui. Additionally, I do not know what button.Click
is, but if it is something related to UI, then it should be handled on the client with a LocalScript
.