Character "Animate" script error when player is respawned right after spawning

Issue Type: Other
Impact: Low
Frequency: Constantly
Date First Experienced:
Date Last Experienced: 2021-05-01 10:05:00 (-05:00)

Reproduction Steps:
If a player character is respawned immediately after spawning, the Animate script that is inserted into the character by default will error. This is the error:
image

After looking at the script, my guess as to why this happens is that that section on the script didn’t run until after that specific character had already been destroyed. A simple fix to this would be to add if humanoid:IsDescendantOf(game) before line 470.

To reproduce: Insert this into a Script in a new place.

local players = game:GetService("Players")

local function onPlayerAdded(player)
	wait()
	player:LoadCharacter()
end

players.PlayerAdded:Connect(onPlayerAdded)

Then click on the error in Output to see the Animate script that the error comes from.

When the wait() is not included, the error does not happen. This is probably because the character (and the Animate script) has not yet been created by the time Player:LoadCharacter() is run.

Expected Behavior:
The Animate script should not cause any errors, and should check if the Humanoid is still a descendant of the game before calling Humanoid:LoadAnimation().

Actual Behavior:
I don’t have any information other than what is shown above.

Workaround:
Ignoring the error that shows in the Output every time in hit play.

1 Like

I have a fix already implemented for this which will go out shortly

4 Likes

Two updates have passed since, and I am still getting the error every time I hit Play. I see that its on a different line now. It was on line 470 before, whereas it is now on line 477.

the fix has now been turned on for this

2 Likes

But isn’t :LoadAnimation() deprecated for the Humanoid? I didn’t expect a deprecated function to be used in Roblox’s engine.

Deprecation means it shouldn’t be used for new work. It’s not like it immediately stops working.

Roblox has a legacy code base of tens of thousands of lines of core UI / animation / movement code (press Play in Studio and inspect CoreGui/StarterPlayer/etc), so it’s understandable they may not immediately be able to update everything to remove all references to deprecated methods every time something is deprecated. They’ll fix it over time.

1 Like

Yeah, I agree with that. Deprecation doesn’t also mean that the functions may not work at all times? I think in a time that Roblox has no idea for updates, actually fix the scripts.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.