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

Toggle GUI Visibility on key press. (Meaningless Question mark ?)

How would I make it so when a key is pressed the, GUI is visible to whoever pressed the button.

1 comment

0

Do you know how to use UserInputService?

1 answer

In a localscript do:

local uis = game:GetService("UserInputService")

local gui = script.Parent --// Define the gui

local open = false

uis.InputBegan:Connect(function(key)
	if key == Enum.KeyCode.K and not open then
		gui.Enabled = true
		open = true
	elseif key == Enum.KeyCode.K and open then
		gui.Enabled = false
		open = false
	end
end)

Accept answer if it works else tell me

4 comments

0

It Dosen't disable the GUI https://gyazo.com/3e9111d48056d94df699978e930caca8 <----For Reference

0

I edited it, try now

0

I've Tried it both with the GUI Pre-Enabled and Disabled. Didn't work.

0

Go to the discord and seek help

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