#Need help linking animations to specific keybinds while using a tool

4 messages · Page 1 of 1 (latest)

little zephyr
#

Trying to do it with specific tools in studio, this is the code I'm using currently:
local UIS = game:GetService("UserInputService")
local animation = game.ServerStorage.Animation

UIS.InputBegan:Connect(function(hit)
if Input.Keycode == Enum.KeyCode.E then
animation:Play()
end
end)

I decided to try it without the tool at first, and looked online but nothing worked, hopefully someone can say how to get it working both in and outside of tools 🙏

dark yacht
#

you need to load your animation first

gloomy pier
# little zephyr Trying to do it with specific tools in studio, this is the code I'm using curren...

the animation needs to be loaded only animation tracks have the play method animation tracks are returned by the load animation method which is used from the humanoid's animator

in order to make it work for tools theres no specific events for input while holing a tool so you would need to make a boolean variable that you set to true/false when the player equips/unequips the tool and check the value of the variable when the inputbegan event is triggered to figure out if they are holding the tool if they are then you can continue and register the key press playing the desired animation