Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Animations that I uploaded not working?

The animations that I uploaded all worked on my game. I then forwarded that game over to a group game, and the animations that I uploaded no longer work. Though, the animations that I use for the menu uploaded by roblox still work. Any suggestions?

(Both games were Filtering Disabled)

All animations use the same code, though ones only uploaded by ROBLOX work.

local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=517348029"

local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
	local plr = game.Players.LocalPlayer
	trackanimation = plr.Character.Humanoid:LoadAnimation(animation)
	trackanimation.KeyframeReached:connect(function(kf)
	print('Working')	
	end)
	trackanimation:Play()
end	
end
script.Parent.MouseButton1Click:connect(playAnimation)

UPDATE: I checked logs and I receive this error:

Animation "http://www.roblox.com/asset/?id=733806517&serverplaceid=739017660" failed to load in "Animation.AnimationId":Animation failed to load

1 answer

✓ Accepted answer

try this to play the animation.

	    local Anim = script:WaitForChild("Animation")
	    local s = player.Character.Humanoid:LoadAnimation(Anim)
	    s:Play()

and put the animation inside the script and name it "Animation" and make sure you EXPORTED the animation!

16 comments

0

you can add clicks and such onto it, this script basically injects the animation from the script into the humanoid then plays it.

0

I did, it was uploaded to the site and all

0

Also, the other game has the animations as play-able, is it a configuration error?

0

strange, try getting an animation track and placing it inside server storage with you animation id, sometimes this stuff happens- this usually happens for my decals though, I've never seen a "playable" function before

0

Will try

0

getting an issue with local Anim = game.ServerStorage:WaitForChild("Animation"), it is having trouble find Animation, even though it is visibly there.

0

Really strange, I use that script for my animations and they work- did you put the animation inside of the script?

0

No, I put it in ServerStorage.

0

I defined it in ServerStorage though.

0

Okay, I tried your way by putting it in the script, and it brought me all the way back to an animation loading error.

0

do you have the full script? Something is definitely wrong with the animation being exported.

0

local Anim = script:WaitForChild("Animation") local player = game.Players.LocalPlayer function playAnimation(AnimationSource) local s = player.Character.Humanoid:LoadAnimation(Anim) s:Play() end script.Parent.MouseButton1Click:connect(playAnimation)

0

using that script you should have the animation inside of the script

0

Yep, I did. Gave me the error that I got with my original script. I checked my game config, and it's the same as the other game that works with the animations.

0

Since this is a really weird bug and you provided me with a working, more simplified script, I'll accept your answer.

0

Sorry man :/ Thanks for the accept!

This discussion is preserved as it was. New answers, comments, and votes are closed.