So I’ve been trying out animations as I’m going to make an attack animation, but I decided to test one first. I make a simple animation, try to get it to play via a script, and It won’t work. Everything seems to work, but for some reason, It’s telling me that Test (Animation Name) Isn’t part of the script when It’s the child of the script. Does anyone know how to fix this?
Code:
local LocalPlayer = game.Players.LocalPlayer
local Character = game.Workspace:WaitForChild(LocalPlayer.Name)
local Hum = Character:WaitForChild("Humanoid")
local Animation = Hum:LoadAnimation(script.Test)
wait(3)
Animation:Play()
Loading tracks to the Humanoid has been Deprecated
You have to use the animator object INSIDE the humanoid now, try this instead…
local LocalPlayer = game.Players.LocalPlayer
local Character = game.Workspace:WaitForChild(LocalPlayer.Name)
local Hum = Character:WaitForChild("Humanoid")
local Animator = Hum:FindFirstChildOfClass("Animator")
if Animator then
local Animation = Animator:LoadAnimation(script.Test)
wait(3)
Animation:Play()
end
However im not sure if they ever REMOVED the old loadanimation method, if this doesnt work could you tell me the animations Priority?
Ok, I tried making the script a child of the animation and classifying it as a parent of a script, and It worked. Do you know why it won’t classify as the child?