Animation works in studio but not ingame

I am currently making a tool that plays an animation when it’s activated, it works perfectly fine in studio but not in game. This is not the first time it happens, i’ve tried multiple scripts and all of them lead to the same thing.

Script:

local Tool = script.Parent
local Player = game.Players.LocalPlayer -- Get local player
local Animation = script.Parent.Animation
local Chr = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Chr:WaitForChild("Humanoid")

while Humanoid and not Humanoid:IsDescendantOf(workspace) do
	Humanoid.AncestryChanged:Wait()
end

local Animation = Tool.Animation
local Animator = Humanoid:WaitForChild("Animator")
local AnimTrack = Animator:LoadAnimation(Animation)

Tool.Activated:Connect(function () -- Mouse is NOT passed, that's Equipped
	AnimTrack:Play()
end)

Just to remember, Humanoid:LoadAnimation() is deprecated.

Can someone please help me :frowning: ?

Notes: It’s not ownership problem, i own the animation and the animation is set to Action

1 Like

Who is the owner of the game and who is the owner of the animation?
If they are both the same owners then it shouldn’t be a ROBLOX issue, if it is then the owner of the game should upload the animation and you should put it in the Animation.

1 Like

Both game and animation ownership are in my group

1 Like

Can you link both the animation and the game, just to make sure.
Else I wouldn’t be completely sure what the problem is.

1 Like

See the game in this link

And see the animation in this link

1 Like

It should work, but supposedly it doesn’t…
I wouldn’t know what the issue is. Could you screenshot the Animator’s properties.

1 Like

Sure, wait a second i’ll go take it

What avatar type(R6, R15) is your animation made for and is this the same avatar type used in your game?

The game is R15 and the animation is made for r15, the problem here is that it works in studio and not in game.

image

Not much to see here, but these are the properties

Oh sorry, I mean the Animation. Not the Animator.

Why are you defining 2 times the same variable and loading the aniamtion into the animater? It think you can just load the animation onto the Humanoid.

The tool’s owner could change though?

Humanoid:LoadAnimation() is deprecated, instead it’s supposed to use Humanoid.Animator:LoadAnimation()

I tried changing the tool owner between me and the group, no difference though.

image

Properties of the animation

Can you send the Tool’s properties?

image

image

This is quite confusing as i used the same script and it worked in both Studio and In-Game

local Tool = script.Parent
local Player = game.Players.LocalPlayer -- Get local player
local Chr = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Chr:WaitForChild("Humanoid")

while Humanoid and not Humanoid:IsDescendantOf(workspace) do
	Humanoid.AncestryChanged:Wait()
end

local Animation = Tool.Animation
local Animator = Humanoid:WaitForChild("Animator")
local AnimTrack = Animator:LoadAnimation(Animation)

Tool.Activated:Connect(function() -- Mouse is NOT passed, that's Equipped
	AnimTrack:Play()
end)

If the tool doesn’t have a handle then turn RequiresHandle to off.

It does have a handle, does that matter?