I am making a T-Pose animation in my game. If you press a button in starter GUI you "buy" the T-Pose animation. It is not working. Please tell me what is the problem and how can I fix it.
Here are the scripts:
This is a local script inside a button of starter gui:
local repstorage = game:GetService("ReplicatedStorage")
local emote = repstorage:WaitForChild("Animation", 100)
local serverstorage = game:GetService("ServerStorage")
local price = serverstorage.Animations.TPose
local TPose = serverstorage.Animations:WaitForChild("TPose", 100)
script.Parent.MouseButton1Down:Connect(function()
local player = game.Players.LocalPlayer
if player.leaderstats.Cash.Value >= price then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - price
local anim = player.Character.Humanoid:LoadAnimation(emote)
anim:Play()
print("Success!")
end
end)
Please tell me what is the problem and how can I fix it. Thanks!

16 comments
you should play the animation from a localscript
It is still not working, and also doesn't shows any error in the output.
include some print()s in your code and try to find the source of the problem. so far i can only think the if condition in your server script is false
I included a "print("Success!")" after "anim:Play()". It didn't print anything.
if script.Parent is a GuiButton you should do script.Parent.MouseButton1Click not MouseButton1Down
I did that but it still didn't work.
what priority is the animation set to? just to make sure it is the case set it to action
the priority is action
nvm can u update the code?
updated
another possibility: WaitForchild() might be yielding the thread but not giving any warnings, remove the second arguments
um i thought you played the animation from the localscript? and MouseButton1Down to MouseButton1Click
Updated again. It shows one error in the output:| 21:16:48.850 - Animations is not a valid member of ServerStorage | even though there is a folder called animations in it.
Local scripts can’t access ServerStorage. Try using ReplicatedStorage instead.
correction: i was wrong, MouseButton1Down is an event of GuiButton sorry. what Denny9876 said is probably the problem i havent noticed that
IT WORKED! THANK YOU SO MUCH!!!!!!!!