Why won't my animation play?

I’ve checked out the animation documentation and copied it exactly but no animation plays. Here’s my code:

local CAS = game:GetService("ContextActionService")
local debris = game:GetService("Debris")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

local animator = hum:WaitForChild("Animator")

local rollAnimation = Instance.new("Animation")
rollAnimation.AnimationId = "rbxassetid://15900397804"

local rollAnimationTrack = animator:LoadAnimation(rollAnimation)


local function Roll(actionName, inputState, _inputObject)
	if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then return end
	
	rollAnimationTrack:Play()
	print("Animation Played")
end

CAS:BindAction("roll", Roll, false, Enum.KeyCode.Q)

The print statement runs fine.

I’m using moon animator if that helps anyone figure out my problem

Thinking its a roblox issue? I’ve figured out its the assetid that’s not working as the roblox dance animation worked fine. Made an animation without moon animator to test and had the same problem of it not playing. Gonna make a bug post for now unless anyone has a solution

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.