Hi, I want to make a script which runs when a Key is pressed down. How can I make it ? I have this :
local UserInputService = game:GetService('UserInputService') local key = 'Enum.KeyCode.Q' -- Use local when Global variables aren't needed
-- Use WaitForChild() on children local Handbook = game.StarterGui:WaitForChild("Handbook") local StartMenue = Handbook:WaitForChild("StartMenue") local GameFrame = StartMenue:WaitForChild("GameFrame") UserInputService.InputBegan:Connect(function(input)
-- Turn the KeyCode Enum into a String
-- Match it to our key
if tostring(input.KeyCode) == key then
-- You can substitute the if statements with the reverse of visible GameFrame.Visible = not GameFrame.Visible end end)

2 comments
Just make a function.
what is this question? this should work what are you asking?