Animations playing in studio but no in game

i made the animations, and its not a group game (localscript in starterplayerr)



local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ViewModelManager = require(ReplicatedStorage.Managers:WaitForChild("ViewModelManager"))
local AnimationManager = require(ReplicatedStorage.Managers:WaitForChild("AnimationManager"))
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local StarterGui = game.StarterGui
local BindableEvent = ReplicatedStorage:WaitForChild("Parte1")



local function playAnimation()
	ViewModelManager:DestroyViewModel()

	local ViewModel, Gunmodel = ViewModelManager:CreateViewModel("VM_apanhar")
	local animations = AnimationManager:LoadAnimations(ViewModel, { "ApanharItem" })
	local abrirPortaAnimation = animations.ApanharItem

	abrirPortaAnimation:Play()

	abrirPortaAnimation.Stopped:Connect(function()
		ViewModelManager:DestroyViewModel()
		local defaultViewModel, _ = ViewModelManager:CreateViewModel("VM_lanterna")
		ViewModelManager:BindViewModel(defaultViewModel)

	
		local defaultAnimations = AnimationManager:LoadAnimations(defaultViewModel, { "Lanterna" })
		if defaultAnimations.Lanterna then
			defaultAnimations.Lanterna:Play()
		end

	
		local flashlightScriptTemplate = StarterGui:WaitForChild("flv")
		local clonedFlashlightScript = flashlightScriptTemplate:Clone()
		clonedFlashlightScript.Parent = player.Character
	end)

	ViewModelManager:BindViewModel(ViewModel)
end


player.CharacterAdded:Wait()


local proximityPrompt = workspace:WaitForChild("CartaoGiver"):WaitForChild("ProximityPrompt")

proximityPrompt.Triggered:Connect(function(player)
	playAnimation()
end)


Could we see the code inside the AnimationManager module? It’s quite hard to help without it as you are just showing us you calling a method from it.

Sure.

-- AnimationManager
local AnimationManager = {}

function AnimationManager:LoadAnimations(viewModel, animationNames)
	local animations = {}
	local animator = viewModel:FindFirstChild("AnimationController"):FindFirstChildOfClass("Animator")
	if animator then
	
		for _, animName in pairs(animationNames) do
			local animation = game.ReplicatedStorage:FindFirstChild(animName)
			if animation then
				animations[animName] = animator:LoadAnimation(animation)
			
			else
			
			end
		end
	else
	
	end
	return animations
end

function AnimationManager:PlayAnimation(animations, animName)
	local animation = animations[animName]
	if animation then
		animation:Play()
	
	else
	
	end
end

return AnimationManager

Do the animations play after a certain amount of time? You could try using ContentProvider:PreloadAsync() to yield until the animations load, you are effectively forcing them to load before they need to be played.

no, the animations play whenever i interact with a proximity prompt, im using it to to animate when grabbing a item