- What do you want to achieve?
As said in the title; I wanna create a Animation-Keybind system.
-
What is the issue? Include screenshots / videos if possible!
I have seen it done before, and I know there’s a bunch of way to do it, I would just like to know the most efficent way of completing the system.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have had some work with keybind’s in the past, but I’m not sure if it would be the most efficent.
–
I’m not asking for code, but rather support on How I should Achieve my goal.
1 Like
Could you give a more specific description?
Right so;
I’m making a game, Where if you press a Button on your keyboard, it’ll do A function.
I wan’t to know, what the best way to go about doing this would be.
Answer
The best system, while simplistic: It should also be user friendly; the best way to achieve this is to have a folder in Server Storage, put animations in said folder (This could be swapped out for another String Value to put the ID of the animation)
, then have a String Value named Keybind
in each animation.
Here’s an example of both ways: 
Scripting Wise
The way I explained above makes it quite easy to script, you could use a remote event to fire when a button is pressed and if it finds that there’s an animation with that keybind, it’ll play that. You do this by using a for I,V in pairs
, you then check each Keybind
Value to see if they match and if they do; you play the said animation.
Note
If you use the UserInputService
feature GetFocusedTextBox()
, you can make it so it doesn’t allow itself to trigger while typing a message in the chatbox. i.e;
local UIS = game:GetService("UserInputService")
if UIS:GetFocusedTextBox() == nil then
TweenTabControl()
end
Script
Here’s a little bit of scripting done for ya; you can use this as a reference for your system.
--//Made By MillerrIAm\\--
--/Variables\--
local UIS = game:GetService("UserInputService")
--/Main Script\--
UIS.InputBegan:Connect(function(KeyPressed)
local Key = Enum.KeyCode
local KeybindValue = "Where the keybind is located."
if KeyPressed.KeyCode == Key[KeybindValue] then
if UIS:GetFocusedTextBox() == nil then
TweenTabControl()
end
end
end)
I hope this helps you out, if it solves your issue; make sure you mark it as the solution.
1 Like