Hello! So I made a sitting animation and a eating animation, and when I test it out in the roblox studio, it works perfectly. But then when I go in game on regular roblox, neither of the animations work. Does anyone know why this might be happening? I will put the code for the eating animation below, but I don't think it has anything to do with my problem.
local Tool = script.Parent local EatAnimation = Tool.Animation Tool.Equipped:Connect(function(Mouse) Tool.Activated:Connect(function() local Character = Tool.Parent local AnimationTrack = Character.Humanoid:LoadAnimation(EatAnimation) AnimationTrack:Play() end) end)
Thank you in advance!
Firstly, make sure you are using a LocalScript. The animation will replicate to the server so you dont have to worry about remotes for this part.
local toolObject = script.Parent local eatAnimation = toolObject:WaitForChild("Animation") local character = game.Players.LocalPlayer.Character local eatAnimationTrack = Character.Humanoid:LoadAnimation(eatAnimation) -- Fired when the player clicks while a tool is equipped. toolObject.Activated:Connect(function() eatAnimationTrack:Play() end)
I removed the Equipped listener because it is unnecessary since the ".Activated" event only fires when the tool is equipped. Also, I placed the LoadAnimation() outside of the listener function because we only want to load it in once, not every time the tool is activated.