Using MenuOpened And MenuClosed

Hello, I want to know how to use GuiService | Roblox Creator Documentation and GuiService | Roblox Creator Documentation but I’m not sure how. Does anyone know how it works?

1 Like

Never mind, I figured it out eventually. :arrow_down:

local GuiService = game:GetService("GuiService")

GuiService.MenuOpened:Connect(function()
	print("Player opened their menu.")
end)

GuiService.MenuClosed:Connect(function()
	print("Player closed their menu.")
end)
4 Likes

Darn you beat me to it >:(

I’ll still say this for anyone else I suppose for future reference:

Looking at the API References, both of these Events fire whenever you open/close your ROBLOX Menu Screen

My guess is that you could implement it as this in a LocalScript? Since it’s only detecting for the changes on your side

local Player = game.Players.LocalPlayer
local GuiService = game:GetService("GuiService")

GuiService.MenuOpened:Connect(function()
	print(Player.Name.." opened their menu.")
end)

GuiService.MenuClosed:Connect(function()
	print(Player.Name.." closed their menu.")
end)
1 Like