Hello DevForum!
Today I am trying to get a drinking animation to play when a tool is used. The script is not working and nothing is coming up in the output or script analysis areas. Linked below are both the script and a picture of the starterpack. Thanks for reading!
It is a drink animation, I created the animation and the animation priority is set to action. When the tool is activated it is printing xyz in the output.
Is this the whole script? If it is, the problem is that you don’t have an “animation” variable and you have to create. Just put local animation at the beginning of the script
I thought maybe the priority was the problem but looks like it isn’t. If there are no errors and the print works, I have no idea why it won’t play.
And the Humanoid:LoadAnimation might be marked as deprecated, but it still works for me
Usually this happens if the owner of the Animation is not the same owner of the game. If this is a group game make the animation creator/owner the group. Also sometimes animation doesn’t play when you test in studio, try to test it in the actual game.
Hi! I tried doing this! Here is the new script I made, it still doesn’t work.
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://10098178988"
print("Got to line 7")
local AnimationLoaded = player.Character.Humanoid:LoadAnimation(Animation)
print("Got to line 9")
AnimationLoaded:Play()
print("You finished")
end)
At the moment all of the print statements are showing up in the output.
First of all, no, you do not need to parent the Animation to the character.
Second of all, no, it is not necessary to do this from a LocalScript (but it should still work).
Third of all, have you tested an animation that Roblox uploaded?