Animate script not working unless I refresh Animation's AnimationId property

I have always remembered forking the Animate script in order to change the run animations, etc. Today I’ve encountered an issue that no matter what I did - the animations didn’t change at all after messing around with the Animate script.

To replicate:

  • hit play, copy the “Animate” script from Workspace > Your Character
  • stop the playtest, paste the Animate script into StarterPlayer > StarterCharacterScripts
  • change the run and walk id’s in the animNames table, make sure the specified id’s are correct
  • seeing this didn’t change any animations but played my avatar’s animations instead, I also changed the Animate > run > RunAnim and the WalkAnim’s AnimationId to the desired id’s (I never did this in the past as it had always worked fine without this step)

The steps above didn’t work for me. The character spawned but with my Roblox avatar’s animations. I noticed that whenever I change the RunAnim’s AnimationId property during a playtest, everything works fine and the run animation is changed to the correct one.

I decided to mess around and test a few things. I ended up modifying the Animate script. I’ve added this code directly after the animNames table:

-- Note that this isn't throughly tested and may contain bugs.

for _, v in pairs(script:GetChildren()) do
	if v:IsA("StringValue") and animNames[v.Name] then
		for i2, v2 in pairs(v:GetChildren()) do
			if animNames[v.Name][i2] then
				v2.AnimationId = animNames[v.Name][i2]["id"]
				if v2:FindFirstChild("Weight") then
					v2:WaitForChild("Weight").Value = animNames[v.Name][i2]["weight"]
				end
			else
				v2:Destroy()
			end
		end
	end
end

The above code just refreshes the AnimationId property of different Animation objects inside the Animate script. The code seems to have worked perfectly, just like I wanted the fork to behave.

My question is: what have I done wrong that the forking method I’ve always used to use didn’t work this time? Did Roblox update the Animate script that the old method failed? Why did it start working after I’ve refreshed the AnimationId property of those Animation objects - why didn’t it start working after I’ve done the above steps?