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

So functions that trigger on hotkey presses get triggered when chatting, how do i prevent that?

Lemme give yall an example, so the hotkey that triggers a function is let's say h, when the player is typing it still registers the hotkey as pressed and fires the function, how to prevent that?

1 answer

✓ Accepted answer

The second parameter of UIS checks if the user is doing something else with the user input such as typing or clicking a button. Do the following to your keypress event will make sure you're not overriding that.

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if(gameProcessed) then return end  -- This will not run any inputs when the player is doing something such as typing 
end

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