Group Animation not playing

Hello how can I get my animation work? I have an animation that I uploaded in my group

https://www.roblox.com/library/6246381291/RUN-ANIMATION

I put it in a script that is located in one of my group games and it will still not play? The animation ID changes but will not play. Here is my script:

local workspacePlr = game.Workspace.MithrilSlate
local humanoid = workspacePlr:FindFirstChild("Humanoid")

local animate = workspacePlr:FindFirstChild("Animate")
local walk = animate.walk
local run = animate.run

if not walk:FindFirstChild("PreviousAnimation") then
	local newVal = Instance.new("StringValue")
	newVal.Value = walk.WalkAnim.AnimationId
	newVal.Name = "Previous"
	newVal.Parent = walk
end

walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=6246381291" --run animaation.
local loaadAnimation = humanoid:LoadAnimation(walk.WalkAnim)

if not run:FindFirstChild("PreviousAnimation") then
	local newVal = Instance.new("StringValue")
	newVal.Value = run.RunAnim.AnimationId
	newVal.Name = "Previous"
	newVal.Parent = run
end

run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=6246381291" --run animaation.
loaadAnimation = humanoid:LoadAnimation(run.RunAnim)
1 Like

Use Animator:LoadAnimation(), this is deprecated

Unfortunately It still does not work.

Can I see your updated code? Not sure if you’re doing it correctly

Sure.

local workspacePlr = game.Workspace.MithrilSlate
local humanoid = workspacePlr:FindFirstChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")

local animate = workspacePlr:FindFirstChild("Animate")
local walk = animate.walk
local run = animate.run

if not walk:FindFirstChild("PreviousAnimation") then
	local newVal = Instance.new("StringValue")
	newVal.Value = walk.WalkAnim.AnimationId
	newVal.Name = "Previous"
	newVal.Parent = walk
end

walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=6246381291" --run animaation.
local loaadAnimation = animator:LoadAnimation(walk.WalkAnim)

if not run:FindFirstChild("PreviousAnimation") then
	local newVal = Instance.new("StringValue")
	newVal.Value = run.RunAnim.AnimationId
	newVal.Name = "Previous"
	newVal.Parent = run
end

run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=6246381291" --run animaation.
loaadAnimation = animator:LoadAnimation(run.RunAnim)

Oh, I see. I don’t think you ever actually played the animation

Something like this?

local loadAnimation = animator:LoadAnimation(walk.WalkAnim)
loadAnimation:Play()

Well if I do that, my animation will play infinitely. I only want it to play when I move around so it looks like I am running

Maybe this post can help?

Well my script actually works when I put it in an empty baseplate. However if I try to put it in my group game, it won’t play by itself unless I use :Play()

My animation is by my group too…???

I have no other scripts interfering as well

I need some kind of tutorial on how make a group animation i guess??

still not sure why it wont work

Wait the amount of seconds that the animation lasts for, then do anim:Stop()

You need to do :Play() ok? But, if you’re animation is looped then you need to wait the amount of seconds that it takes for that animation to finish, and then do :Stop()!

Example:

anim:Play()
wait(12)
anim:Stop()

but with the amount of seconds that the animation takes to “end”;

It didn’t work. It stops when I am still walking

You need to detect when you’re walking using Humanoid.Running then, that’s a different question.

Wouldn’t constantly detecting humanoid changed cause lag?

Its not humanoid.Changed. it’s Humanoid.Running, and no.