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

How Do I Set A Key To Open A GUI?

The game I am making has a mouse lock so that when you move your mouse in third person it also moves the camera with it.

Does anyone know how I can assign a key to open a GUI and then once the GUI is open I am able to freely move my mouse around?

I am not necessarily asking for scripts but at least a way to do this

if this is too unspecific of a question please tell me

thanks.

:)

1 answer

Use UserInputService and a Debounce.

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, GPE)
if GPE then return end

if input.KeyCode == Enum.KeyCode.A then --replace "A" with whatever you want as a key
	if not Debounce then
	--code here
	Debounce = true
	elseif Debounce then
	--code here
	Debounce = false
	end
end
end)

1 comment

0

ok

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