Gun keeps looping animation despite specific instructions not to

So here’s my problem:

My reload animation keeps looping even though I set Looped to false for the animation. Here is my code:

--Plays reload animation
RL.OnServerEvent:Connect(function(Player, Gun)
	local Ammo = Gun.Ammo
	local A1 = Instance.new("Animation")
	A1.AnimationId = GunStats.WeaponStatistics[Gun.GunId.Value]["ReloadAnimation"]["ID"]
	local ReloadAnim = Player.Character.Humanoid:LoadAnimation(A1); A1:Destroy()

	--Pre-loading the primed animation so it can go back to priming after reloading
	local A2 = Instance.new("Animation")
	A2.AnimationId = GunStats.WeaponStatistics[Gun.GunId.Value]["Animations"]["Primed"]
	local PrimedAnimation = Player.Character.Humanoid:LoadAnimation(A2); A2:Destroy()

	ReloadAnim.Looped = false
	ReloadAnim:Play()
	local Grip = Gun:FindFirstChild("Grip")

	for _, Action in pairs(GunStats.WeaponStatistics[Gun.GunId.Value]["ReloadAnimation"]["Actions"]) do
		ReloadAnim:GetMarkerReachedSignal(Action):Connect(function(ID)
			Grip.UST.SoundId = ID
			Grip.UST:Play()
		end)
	end

	local Sub = Ammo.Total.Value - (GunStats.WeaponStatistics[Gun.GunId.Value]["ClipSize"] - Ammo.InClip.Value)
	local AddToClip = 0
	
	if Sub < 0 then 
		AddToClip = Ammo.Total.Value; Ammo.Total.Value = 0
	else 
		Ammo.Total.Value = Sub; AddToClip = GunStats.WeaponStatistics[Gun.GunId.Value]["ClipSize"] - Ammo.InClip.Value 
	end
	
	ReloadAnim.Stopped:Connect(function()
		if Player.Character:FindFirstChild(Gun) then
			PrimedAnimation:Play(); PrimedAnimation.Looped = true
			Ammo.InClip.Value = Ammo.InClip.Value + AddToClip
		end
	end)
end)

Here’s a GIF of what’s going on:

As you can see after the first reload animation it starts again. It keeps going on indefinitely after that even though I put “Looped” to false.

Anyone know what’s going on and how to get it to stop?

Side note: It plays the sounds when the keyframes are reached (the bolt cocking back, the stripper clip going in and the bolt cocking forward) the first time the animation plays but after the animation subsequently repeats itself it stops playing those sounds.

1 Like

It looks like the server code is fine, is it possible that you’re firing the event on the client-side too much?

Maybe you made the animation looped in the animation editor?

Even if he did, in his script he set looped to false.

Whoops, accidentally marked you as the solution

That turned out to be the issue, yes.