Check for new inputs after input

Hello currently making a quick emotes menu local script

local function onTauntKeyCode(input)
	local one, two, three, four, five, six = table.unpack(animationsTable)
	for _, key in buttonList.TauntKey do
		if key == input.KeyCode and not fired then
			print('opening menu')
			
				UserInputService.InputBegan:Connect(function(input)
					if input.KeyCode == buttonList.TauntListKeys[1] then
						print(input.KeyCode)
					end
				end)
			
			fired = true
		elseif key == input.KeyCode and fired then
			fired = false
			print('closing menu')
		end

	end
end

of course this doesn’t work but basically I want to check for new inputs once the player presses G and then IF the input is correct or the player presses G the “menu” closes.

local function onTauntKeyCode(input)
    print("Function Called")
	local one, two, three, four, five, six = table.unpack(animationsTable)
    print(buttonList)
	for _, key in buttonList.TauntKey do
        print(key)
		if key == input.KeyCode and not fired then
			print('opening menu')
			
				UserInputService.InputBegan:Connect(function(input)
					if input.KeyCode == buttonList.TauntListKeys[1] then
						print(input.KeyCode)
					end
				end)
			
			fired = true
		elseif key == input.KeyCode and fired then
			fired = false
			print('closing menu')
		end

	end
end

Run this and show the output!

1 Like

sorry for late reply, i thought people gave up on this post so i went to do other stuff, lets see…

 21:23:42.199  Function Called  -  Client - TauntScript:27
  21:23:42.199   â–Ľ  {
                    ["AimKey"] =  â–¶ {...},
                    ["ClassicCameraKey"] =  â–¶ {...},
                    ["RunKey"] =  â–¶ {...},
                    ["TauntKey"] =  â–¶ {...},
                    ["TauntListKeys"] =  â–¶ {...},
                    ["ToggleCameraKey"] =  â–¶ {...}
                 }  -  Client - TauntScript:29
  21:23:42.199  Enum.KeyCode.G  -  Client - TauntScript:31
  21:23:42.199  opening menu  -  Client - TauntScript:33
  21:23:42.199  Enum.KeyCode.DPadUp  -  Client - TauntScript:31
local function onTauntKeyCode(input)
	--print("Function Called")
	local one, two, three, four, five, six = table.unpack(animationsTable)
	--print(buttonList)
	for _, key in buttonList.TauntKey do
		--print(key)
		if key == input.KeyCode and not fired then
			fired = true
			print('opening menu')

			UserInputService.InputBegan:Connect(function(input)
				for _, key in buttonList.TauntListKeys do
					if key == input.KeyCode and fired then
						fired = false
						print(input.KeyCode)
					end
				end
			end)

		elseif key == input.KeyCode and fired then
			fired = false
			print('closing menu')
		end

	end
end

this is what I have at the moment which works, idk if this is best…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.