I made an animation, published it to Roblox, and it doesn’t play. The code is correct, because the code works with my older animation I made. But the animation I made today doesn’t work. I set the priority to Action 3 but id still doesn’t work. Please help.
Well, if that the case.
(1)Try to make the sure that the animation is loaded before playing
(2) If there is idle animation that are looped, try making the animation you created have higher priority than idle ones
(3)Overall, try debugging process
local tool = script.Parent
local animationToLoad = tool:WaitForChild("Animation")
local character = tool.Parent -- refer to player.Character
tool.Activated:Connect(function()
if character ~= nil then
local loadAnim = character:WaitForChild("Humanoid"):LoadAnimation(animationToload)
loadAnim:Play()
end
end)
oh ok, my previous code was doing humanoid.Animator, lemme try using humanoid:LoadAnimation instead
Edit: still doesn’t work, my code does run though because it printed the animationId. By the way, could it be an invalid animation id? The animation id is rbxassetid://13016146546
local tool = script.Parent
local animationToLoad = tool:WaitForChild("Animation")
tool.Activated:Connect(function()
local character = tool.Parent
if character ~= nil then
local loadAnim = character:WaitForChild("Humanoid"):LoadAnimation(animationToload)
loadAnim:Play()
end
end)
--inside a user input service
local function playAnim(character, animation)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
-- need to use animation object for server access
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator then
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
return animationTrack
end
end
end
local mineAnim = Instance.new("Animation",workspace)
mineAnim.AnimationId = "rbxassetid://12495659836"
playAnim(plr.Character,mineAnim)
The animation works with an old animation I made last month, but it doesn’t with the one I made today.
I’m getting the character from game.Players.Character, and again, the code works for one animtion but doesn’t for the other animation, theres just a change in the animation id.