Play() not working


This is my script from all of the replies and it still doesn’t work

you need to first load the animation, you can use the humanoid of the dummy or if the dummy has a animationcontroller inside instead of a humanoid

Humanoid version:

PathToYourHumanoid:LoadAnimation(script.Parent.Animation):Play()


AnimationController version:

PathToYourAnimationController:LoadAnimation(script.Parent.Animation):Play()


local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
if message == "test" then 
    local track = animator:LoadAnimation(script.Parent.Animation)
    track:Play()
end

give this a shot, you do not need to create an animator if you are trying to animate the player, its already there under the humanoid

Humanoid:LoadAnimation() is deprecated, use an animator instead.

Perhaps the animation priority is set wrong? Use Action instead.

Im trying to animate a dummy,. so it wont work

dummys still have the animator under their humanoid, created when the game is run

Then what am I supoosed to have as a child in the dummy?

local character = path to your rig
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
if message == "test" then 
    local track = animator:LoadAnimation(script.Parent.Animation)
    track:Play()
end

just get the dummy instead of the player

That’s only for Players, not any humanoid

Nope, wont work. No outputs or anything.

local animation = script.Parent:WaitForChild("Animation")
local animator = script.Parent:WaitForChild("Humanoid"):FindFirstChild("Animator") or Instance.new("Animator", script.Parent:WaitForChild("Humanoid"))
game:GetService("Players").PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if message == "test" then
			animator:LoadAnimation(animation):Play()
		end
	end)
end)

AnimationRepo.rbxl (73.3 KB)

Nope, unless something is supposed to be changed in explorer then I dont know.
image

Okay heres a tutorial:

  1. Insert the dummy:

image

  1. Use the Humanoid inside the dummy, or if you want to use something else delete the humanoid and add a AnimationController I recommend just using the Humanoid since thats already there or, you could add a Animator inside the humanoid:

image

  1. Insert a script, and a animation, make sure the animation has the correct animation ID:

image

  1. Put the following code inside the script:

image

script.Parent.Humanoid:LoadAnimation(script.Animation):Play()

-- Or put Script.Parent.Humanoid.Animator:LoadAnimation(script.Animation):Play() if you are using a animator

Load animations with the ANIMATOR, Humanoid:LoadAnimation() is deprecated

1 Like

just made this, it works perfectly you just have to adapt for your chat module

here is the code used

local rig = script.Parent -- change to your path
local hum = rig:FindFirstChild("Humanoid")
local animator = hum:FindFirstChild("Animator")
local track = animator:LoadAnimation(script.CrouchIdle)
task.wait(3)
track:Play()

works excellently and their is an animator there already

Everything looks fine, perhaps did you not set the animation id? You also must say “test” in the chat for the animation to play during a play test.

I did, Its there. 15189023626 is the ID.

it works fine but its not good practice, deprecated does not mean deleted. which is what @TaxFraudBruh essentially assumed you knew. just because it works fine doesn’t mean its always a good idea

Yeah I know its not deleted, just saying it still works