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

Animation works in Studio and Test Server, but not in game?

I want the animation to play when the player clicks, but it doesn't work in a game. It works in Studio and a Test Server.

script.Parent.Activated:connect(function()
if debounce then 
	local animationswing = Instance.new("Animation")
	if game.Players.LocalPlayer.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
	animationswing.AnimationId = "rbxassetid://886800502"  --put animation id here
	else
	animationswing.AnimationId = "rbxassetid://886799196"
	end
	local animiTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animationswing)	
	if mouse.Target:FindFirstChild('Breakable') then
		if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - mouse.Target.Position).magnitude <= 16 then
		if mouse.Target.Parent ~= workspace.Resources then
			local mousetarget = mouse.Target
			debounce = false
			animiTrack:Play()
			animiTrack:AdjustSpeed(stats["Speed"])
			animiTrack.KeyframeReached:connect(function(kf)
				if kf == "End" then
				script.Parent.Server:FireServer(mousetarget, stats)
				debounce = true
				end
			end)
			
		end
	end
	end
end
end)

This is in a local script.

Output:

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

4 comments

0

Try asking this in the forums, I do not think there is anything wrong with your code (just briefly scanning through it) just might be something you have to troubleshoot. Go to the fourm section at the side of your roblox page and they should be able to help you. -Tritous

0

Can you post the error you got? If there wasn't one in game, then press CTRL + F9 to see the output.

0

Why CTRL + F9? Did nothing different to F9...

0

And if you read the post, you should've known......

1 answer

I tried answering you on the chat but you were offline. Make sure your animation is created by you, or is in the group creations. The Anim, must be own by you or the group depending on the game you are making either it be a game made by you, or a game in a group.

(edited)

Hope this helps, it's how I fixed my animation problems.

2 comments

0

Already tried that. Turns out the problem was my studio is corrupted D:

0

It was owned by the group.

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