I've been trying to call an animation I made, and I have no idea how to do it. I checked the wiki and could not find ANY code on it. Does anybody know how to call/play an animation when a button is pressed?
I have this so far
local UserInputService = game:GetService("UserInputService")
local function onInputBegan(input,gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
local keyPressed = input.KeyCode
if keyPressed == "Shift" then
--animation
end
end
end
UserInputService.InputBegan:connect(onInputBegan)

1 comment
also; make sure the animation is owned by you, or else it won't work and it'll send you an error saying "insufficient permission" or "unauthorized" or whatsoever, it just won't work if you don't own the animation.