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

Do I need a remote event to show a GUI?

Trying to make a quest GUI that opens when you click something.

script.Parent.MouseClick:Connect(function()
	game.Players.LocalPlayer.PlayerGui.QuestGUI.Frame.Visible = true
end)

I have that in a local script but nothing happens when I click it. Do I need to use remote events just to change the visibility of a GUI? I also tried it in a non-local script and it said that the GUI was nil even though it was not.

Can anyone enlightenment in how I'm supposed to do this?

3 comments

0

What's the error when you use a local script? If it is a different ScreenGui you can use BindableEvents.

0

why would u need a bindable event?

0

It's just a way that I personally use, we can also index the target gui normally. Anyways, the problem has been answered (MouseClick -> Activated).

1 answer

EDIT: I did not know that you are using a ClickDetector. Whoops!

While ClickDetectors can work using local scripts, it is not a good idea to put local scripts in the detectors because the scripts can only work if it is a descendant of a Player (e.g. put it in a Gui, or StarterPlayerScripts so that the scripts inside can be copied to the Player's PlayerScripts and run).

Here is the code, which will be in a local script that is located in StarterPlayerScripts:

local detector = workspace.HixBox:WaitForChild("ClickDetector") -- Where is the ClickDetector located in?
detector.MouseClick:Connect(function()
	game.Players.LocalPlayer.PlayerGui.QuestGUI.Frame.Visible = true
end)

If you have any questions, feel free to put them in the comments. I hope this will work.

3 comments

0

@CStarGamer14 - It didn't work. No errors and its in a local script. Here are some screenshots of where I have things located. https://gyazo.com/0c9e472e179924ba6bc7ec45d9762696 https://gyazo.com/4ba52e0b6cb6ceab5bfed8a0783624e4

0

Oh I thought you were using a GuiButton! I'm gonna edit my answer a little bit.

0

Updated my answer, make sure to set the "detector" variable to the right location of the detector.

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