So. me and a group are making a restaurant game but i want it that if the player has the food they click the left mouse. And the animation only plays if the burger is in hand. But the animation doesn't move. here is the script:
local animation = Instance.new("Animation")
animation.AnimationId = "https://www.roblox.com/Asset?ID=1069941509"
local trackanimation = nil
local playability = true
function playAnimation(AnimationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)
trackanimation.KeyframeReached:connect(function()
print ('Working')
end)
trackanimation:Play()
end
end
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local waituntilback = script.Parent.Parent.Hamburger.Equipped:connect()
script.Parent.Parent.Hamburger.Equipped:connect(function()
if not script.Parent.Parent.Hamburger.Equipped:connect() then
playAnimation(waituntilback) else
playAnimation()
end
end)
is something wrong about it?

7 comments
Well. It does work so it wont play without the food. but the animation wont play when there is a tool and its hand
all it does it that it only play animation when you un-equip it
If you used normal Roblox Animation editor then the plugin will ignore tools and your hand with the tool will be frozen
So I have to use a different animation editor?
No, the ROBLOX animation editor works perfectly fine. Make sure when you're creating the animation that you only have the selected limbs that you're using. Also, just be sure your tool is also anchored (I doubt you left it anchored but I might as well mention it).
i have anchored it, the animation won't move with tool. all i need is the animation to move with the tool equipped.
is my script wrong?