Animation works in the studio Doesn't work for non-studio games

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want animations to work in games, not studios

  1. What is the issue? Include screenshots / videos if possible!

Create and export animations
Make the animation work when you lift the tool with the script
I’m making the animation work when I hold the tool and click the mouse.
It works fine in the studio.
Doesn’t work in non-studio games

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I searched several documents but nothing helped me

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

--when equipped

local tool = script.Parent

tool.Equipped:Connect(function()
	local plr = game.Players:FindFirstChild(tool.Parent.Name)
	Idle = plr.Character.Humanoid:LoadAnimation(script.AnimHandle)
	Idle:Play()
end)

tool.Unequipped:Connect(function()
	Idle:Stop()
end)
 ------------------------------------------------------------------------------
--When a tool is attached and clicked

local Tool = script.Parent
local Player = game.Players.LocalPlayer
local Char = game.Workspace:WaitForChild(Player.Name)
local Humanoid = Char:WaitForChild("Humanoid")
local Check = 0
local Enable = true

Tool.Activated:Connect(function()
local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
if Enable == true then
	Enable = false
		if Check == 0 then
		humanoid:LoadAnimation(script.Anim01):Play()
		script.Parent.Combo.C0:FireServer(script.Parent.Handle)
		script.Swing:Play()
		wait(1.5)
		Check = 1
		Enable = true
	else if Check == 1 then
		humanoid:LoadAnimation(script.Anim02):Play()
		script.Parent.Combo.C1:FireServer(script.Parent.Handle)
		script.Swing:Play()
		wait(1.5)
		Check = 2
		Enable = true
	else if Check == 2 then
		humanoid:LoadAnimation(script.Anim03):Play()
		script.Parent.Combo.C2:FireServer(script.Parent.Handle)
		script.Swing:Play()
		wait(1.5)
		Check = 0
		Enable = true
	end
	end
	end
 end
end)

while wait(5) do
	if Check == 1 or Check == 2 then
		Check = 0
	end
end


Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You keep loading animations each time you want them to run. Load them at the beginning of the script, then just Play() them when needed.

Is this a local script? Animations are only run by local scripts. They may run in a Studio session since they are played locally when testing.

It’s a local script, but it’s still not fixed

runs in the studio
Doesn’t work on non-studio games