Right so I have a script (the one below), which is a localscript inside of the tool.
local tool = script.Parent
local player = game.Players.LocalPlayer
local anim = script:FindFirstChild("slash")
local cooldown = false
tool.Activated:Connect(function()
print("on")
if cooldown == false then
local humanoid = player.Character:FindFirstChild("Humanoid")
local animation = humanoid:LoadAnimation(anim)
animation:Play()
cooldown = true
wait(2)
cooldown = false
end
end)
It gives the error LoadAnimation requires an animation object.
What is the output of print(anim.ClassName) ? Additionally, are you sure that the animation exists at the time of running? You may need to use :WaitForChild(“slash”) rather than :FindFirstChild(“slash”)
It appears that your usage of :FindFirstChild() is resulting in the code searching for the animation before it actually exists on the client. Switch Line 3 to:
Ensure that you have set the Priority of the animation to be higher than Core (and most likely to the highest priority, Action.) To do this, open the animation in the Animation Editor, click the three dots, mouse over Set Animation Priority, and then click on Action. After that, export your animation again and overwrite the prior one.
I also assume that the animation you are playing is owned by you. If it is uploaded to a group that you have developer access to, try playing the game in the player to see if the animation plays. Animations are a bit finicky in this regard as of the last time I used it in a group, though I may be incorrect.
I’m really not sure what’s happened, I just made an anim in studios and exported it, is it then attached to me or the group? (it was made in a different place than the main game)
Try using print Commands. I’m guessing “anim” is nil. Using FindFirstChild is bad, as it doesn’t return a error if it’s not there, so try using WaitForChild for those things instead.
As you upload an animation, in the box where you can write the name/description of the animation, you’ll be able to see a Creators dropdown menu that defaults to “Me”. If you click on the drop down, it should list the groups that you have permission to upload assets to.