Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

The GUI doesn't open, even with a ClickDetector and function. Why?

BACKSTORY: I am trying to make a service that is like CheckMeIn (A service that checks you in to a hotel room). I was working on the gui, so I made a script. The GUI is supposed to be a Windows styled GUI system. The script is shown below:

gui = game.StarterGui.PCTabGui
clickable = script.Parent
gui.Enabled = false;

function onMouseClick()
gui.Enabled = true;
end

function close()
	gui.Enabled = false;
end


clickable.ClickDetector.MouseClick:connect(onMouseClick)
gui.Frame.Minimize.MouseEnter:connect(close)

This appears a few times in the output in red: cloud_1685949788.ToDoListPlugin.NexusPluginFramework.NexusProject:253: Requested module experienced an error while loading

The GUI also doesn't show up.

Could anybody help me in this?

1 comment

0

Please use Connect instead of connect as it's deprecated.

2 answers

Your issue is the very first line. You get the UI from StarterGui which is where the UI gets copied from, not the actual UI that is being displayed to the user at the moment. In other words, when the player joins the game, all the contents from StarterGui gets copied to PlayerGui which is where the actual UI gets displayed. To alter the player UI you would need to access this folder which is accessible from game.Players.LocalPlayer.PlayerGui using a LocalScript.

as i see here, you define GUI as the StarterGui Instead of playergui and also, Click detector only works on script and you cant use local script for it. And i think the error on the output come from a plugin. I suggest you to find a tutorial on youtube

1 comment

0

Click Detectors do work with local scripts, however you'll need to put the local script somewhere it can run. There are some places where local scripts don't work, this includes workspace. You can see where local scripts are able to run here: https://developer.roblox.com/en-us/api-reference/class/LocalScript

This discussion is preserved as it was. New answers, comments, and votes are closed.