Tool animation wont play

maybe it has something to do with the animation itself?

No, I have not tested an animation roblox uploaded, is that a problem?

I just want to know if the problem is the animation or not. If you test an animation Roblox uploaded, you won’t get any asset errors.

Should I use any animation or should I find a specific one?

You can use any animation. There’s many factors, like the AnimationPriority might be wrong or the animation just won’t load. Roblox’s animations most likely don’t have those problems so we will test one out.

This is because your script is a LocalScript. Change it into a Server Script for the tool to function. Tools will not Activate on LocalScripts. Is there any reason you had it as a LocalScript or was it just an accident?

1 Like

I had it in a local script as I started off by following a tutorial however when it didn’t work I tried to debug it.

So, did it work when you switched types, or is there still something going on?

It is in a serverscript now under the tool, I am using the script below and it is still not working.

script.Parent.Activated:Connect(function()
	print("Playing Animation")
	local player = game.Players.LocalPlayer
	local Animation = Instance.new("Animation", player.Character)
	print("Got to line 5")
	Animation.AnimationId = "rbxassetid://10064525225"
	print("Got to line 7")
	local AnimationLoaded = player.Character.Humanoid:LoadAnimation(Animation)
	print("Got to line 9")
	AnimationLoaded:Play()
	print("You finished")
end)

You can’t get a LocalPlayer in a Server script.

You could do this:

script.Parent.Activated:Connect(function()
local player = script:FindFirstAncestorWhichIsA("Player") or game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
local Animation = Instance.new("Animation", player.Character

Animation.AnimationId = "rbxassetid://1006452225"

local AnimationLoaded = player.Character.Humanoid:LoadAnimation(Animation)
AnimationLoaded:Play()

print("Played Animation")
end)

Hello! The animation is not working however, the “Played Animation” print did come up in the output.

Is your animation priority set to Action?
Try adding this if not:

animation.Priority = Enum.AnimationPriority.Action

If the animation does not override the other animations with Action, it will not play.

It is currently set to action, but I will add that in and try it! Where in the script would I add this in, I tried adding it in but I am getting errors.

Perhaps try this now, let me know if you get errors.

script.Parent.Activated:Connect(function()
local player = game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
local Animation = Instance.new("Animation", player.Character)

Animation.AnimationId = "rbxassetid://1006452225"
wait()
local AnimationLoaded = player.Character.Humanoid:LoadAnimation(Animation)
AnimationLoaded:Play()

print("Played Animation")
end)

Still doesn’t seem to be working, however, the played animation is coming up in the output. As an additional resource this is what the animation looks like (this is my first one ever):

What exactly is coming in the output?

Below is a picture of the output, I clicked on the screen 19 times.

Did you click on it 19 times or is it repeating itself 19 times?

I clicked on the tool 19 times.

your animation is made on r6 character, but your character is r15, do it over again on r15 dummy or go to game settings and force change avatars to r6, you cannot play r6 animations on r15 characters and vice versa

3 Likes