Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Echtic 128
5 years ago

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

Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

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

Ad

Answer this question