So I've made a quick script that when I press the letter Q it plays the animation ID I gave it, But On Press when testing it doesn't want to play.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input == Enum.KeyCode.Q then
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://5903616380"
local track = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim)
track.Looped = true
local UserInputService = game:GetService("UserInputService")
track:Play(.1, 1, 1)
end
end
end)

1 comment
Line 7 should be input.Keycode