I left Roblox for a few months but now I’m back. I’m a little rusty, though, because something’s weird with my script.
script.Parent.Activated:Connect(function()
local anim = game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(script.Parent.Animation)
anim:Play()
end)
The animation does not work.
This is a group game and the animation is under the group. This is a local script in the root of a tool. I don’t understand what’s gone wrong. There are no errors in the output.
Humanoid.Animator is the new way to do it. Humanoid.LoadAnimation was deprecated a while ago. Also, I tried using humanoid.loadanimation before, and it still didn’t work.
Here is a shot in the dark, but maybe try looking for the humanoid in the character before running the rest of the script… it might be trying to run the animation before the character is found.
I think that would work as the character (which contains a humanoid) doesn’t load in right away. Try doing, when getting both the character and humanoid a WaitForChild()