Hi devs, I have made an animation. It plays when you click on a TextButton. It works when I test on Roblox Studio but it does not work in game. This is the local script script inside the button I have made:
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://6935670812"
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 ("Animation At-Ease played")
end)
trackanimation:Play()
end
end
script.Parent.MouseButton1Click:Connect(playAnimation)