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

How can I open a GUI from another GUI?

Greetings everyone, I would like to ask for help.

I want to make a system, where if you press a GUI button, it pops up for others if they are a specific rank in a group. I am sure I can make the group part of it, but how could I open the second GUI when I press the first GUI button? I was experimenting with RemoteEvents but I couldn't make it to work. The gui didn't show up.

I hope somebody can help me with it, thank you for any help!

1 comment

0

A RemoteEvent won't work unless you want communication between a server script and local script. Working with GUIs means you're working with the Client. You would use a BindableEvent because it's used for communication between server and server or client and client.

2 answers

Steps:

  1. Insert a Button into that GUI that is going to open it. (design it however you want)

  2. Insert a LocalScript into the button:

local button = script.Parent

button.MouseButton1Down:Connect(function()
	if script.Parent.Parent:WaitForChild("GuiName").Enabled == false then
		script.Parent.Parent:WaitForChild("GuiName").Enabled == true
	else
		script.Parent.Parent:WaitForChild("GuiName").Enabled == false
	end
end)

Well i know one way i dunno if it is good but bassicaly what you do is:

Make the button with local script that will fire event to server script:

script.Parent.MouseButton1Click:Connect(function() local event = game.ReplicatedStorage.RemoteEvent event:FireServer() end)

This will fire the event.

Then you make server script that will receive the fire event and send another one (sorry for bad explanation):

local event = game.ReplicatedStorage.RemoteEvent local event2 = game.ReplicatedStorage.RemoteEvent2 event.OnServerEvent:Connect(function() event2:FireAllClients() end)

AND then you make another local script in gui (put wherever you want) and it will receive another event (again sorry for explanation):

local event2 = game.ReplicatedStorage.RemoteEvent2 local player = game.Players.LocalPlayer event2.OnClientEvent:Connect(function() if player:GetRankInGroup("group id") == 123 then local text Instance.new("TextLabel", player.PlayerGui) print("received3") end end)

You gotta make 2 remote events in replicated storage but i guess you know it.

Hope it helps.

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