TextButton Hotkey Activation

How do I make a TextButton be useable by a hotkey?

I have a TextButton that when clicked, stops the dance that the player is doing.

How can I make it so that when they click the letter Q on their keyboard, it works as though they are clicking it with there mouse, therefor stopping the animation.

It sounds as simple as it is. I just can’t figure out how to word it / find a proper, clear tutorial.

Instead of defining an anonymous function for each of your buttons, make it a seperate function and then call it seperately. There is no method for TextButton that fires all of it’s connections.
This is what I mean:

local function func()
    print("Hello");
end

TextButton.MouseButton1Click:Connect(func);
game:GetService("UserInputService").InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Q then func() end
end)

That code doesn’t seem to do the trick.

(I put it inside the TextButton itself)

Could you elaborate? How does it not do the trick?

after adding a script with that code, Q does not activate the button

local function func()
– what you want to happen
end

script.Parent.MouseButton1Click:Connect(func)
game:GetService(“UserInputService”).InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
func()
end
end)