Animation not playing

in the roblox studio my animation button working good but in the actual game its not working for some reason. i hope get it fixed

studio footage:
https://gyazo.com/bfee14d33843bfce895b5a8411336993

acual game footage:
https://gyazo.com/92a7b330399fa4db2df57feb8ab8118b

my button local script:

--sit
local Debounce = false
local userinputservice = game:GetService("UserInputService")

script.Parent.MouseButton1Click:Connect(function()
	

	local animation = script.Parent:FindFirstChild("Sit")
	--animation.AnimationId = "rbxassetid://11164244801"
	local player = game.Players.LocalPlayer
	local human = player.Character:FindFirstChild("Humanoid")
	local player = game.Players.LocalPlayer
	local Animator = human:FindFirstChild("Animator")
	local playAnim = Animator:LoadAnimation(animation)
	
	for i,v in pairs(human:GetPlayingAnimationTracks()) do
		--human.Parent:FindFirstChild("HumanoidRootPart").Anchored = false
		v:Stop()
	end
	
	if Debounce == false then
		Debounce = true
		playAnim:Play()
		wait(1)
		--player.Character:FindFirstChild("HumanoidRootPart").Anchored = true
		
		userinputservice.InputBegan:Connect(function(key,chatted)
			if (not chatted) then
				if key.KeyCode == Enum.KeyCode.Space then
					--player.Character:FindFirstChild("HumanoidRootPart").Anchored = false
					playAnim:Stop()
				end
			end
		end)
		
		wait(0.5)
		Debounce = false
	end	
end)

I believe your issue is to do with animation ownership, I’ve ran into this topic a lot and it can be confusing.

Is your game owned by a group?

If so, there’s a chance that when you published the animation to Roblox, that you published it under your account’s ownership. This would look fine in Studio, since your client is allowed to use your own animations. However in the actual game, it wouldn’t play because the server can not access animations owned by you.

Here’s the fix if this is your case:

Find your animation again and click Publish to roblox as usual:
image

But then before you click submit, change the “Creator” from “Me” to the group that owns the game:

Copy the ID, replace the old animation, publish and test in-game!

I do think Roblox should make it more clear when an Animation will and won’t play, because especially for newer developers (like me when I started using animations) this was a rather confusing roadblock to come across.

Nonetheless, I hope this helps you! :slight_smile:

1 Like