Hi, I recently made an animation and when I tested in a separate game in-studio it was working fine. Testing area - Roblox Studio - Gyazo
As you can see it works fine here. However, when I test in-game and in-studio of my actual game the animation fails to play. It is a group game so I did place the animation within my group and I have set the animation priority to action. Also, I waited a day just in case roblox may have needed time to verify it and I re-uploaded the animation yet it still doesn’t work. Thus, I believe there is a problem with the script itself.
local player = game:GetService("Players").LocalPlayer
local character = player.CharacterAdded:Wait()
local animation = script.Parent:FindFirstChild("Animation")
local eatAnim = character:WaitForChild("Humanoid"):LoadAnimation(animation)
local sound = script.Parent:FindFirstChild("Eat sound")
local canEat = true
script.Parent.Activated:Connect(function(plr)
if canEat then
canEat = false
eatAnim:Play()
wait(.2)
sound:Play()
wait(1)
canEat = true
end
end)
local tool = script.Parent
local animation = tool:FindFirstChild("Animation")
local sound = tool:FindFirstChild("Eat sound")
local canEat = true
local char,hum,eatAnim
tool.Equipped:Connect(function()
char = tool.Parent
hum = char:FindFirstChildOfClass("Humanoid")
if hum and not eatAnim then
eatAnim = hum.Animator:LoadAnimation(animation)
end
end)
tool.Activated:Connect(function()
if not canEat then return end
canEat = false
eatAnim:Play()
wait(.2)
sound:Play()
wait(1)
canEat = true
end)
Not sure how much it’ll work but I think it could be that CharacterAdded still waiting for the character to exist, so I think it’s best if you set the EatAnim the first time it is equipped. If this doesn’t work then I think it’s something up with the animation