Hello, I recently made a 'Dances' GUI that allows the player to click to expand upon different dances, which they can click to dance.

It works fine in studio, but testing it in game reveals this error. https://imgur.com/a/9tT7Fme

It explains that the animations didn't load properly, even though I own them.

Any issues or fixes? Feel free to comment.

My code:

local player = game.Players.LocalPlayer
local character = player.Character
repeat wait()
	character = player.Character
until character
local hum = character:WaitForChild("Humanoid")
local emote = hum:LoadAnimation(script.Animation) -- The animation
playing = false
local textcolor = script.Parent
local equipped = Color3.new(0, 1, 0)
local unequipped = Color3.new(1,1,1)

script.Parent.MouseButton1Click:connect(function()
	if playing == false then
		emote:Play()
textcolor.TextColor3 = equipped
		playing = true
	elseif playing == true then
		emote:Stop()
textcolor.TextColor3 = unequipped
		playing = false
	end
end)