Same here, I explicitly put some lines to check if the NPC is in workspace before calling loadanimation, and if it isn’t i put it in the workspace, but I’m still getting thousands of these errors. Not only that, I also wrap LoadAnimation in a pcall so I honestly do not understand why its not being silenced and still ending up in the error log. The error never happens in studio
Hey! So I never updated the post, but it seems to be coming from roblox internal scripts, I later realized that the “Type” is “Client” and my NPCs runs with a server script, so wasn’t that.
Adding their “Animate” script in StarterCharacterScripts (Copy-Paste the one inside a character) and adding this line at the top of the “playAnimation” function seems to have fixed the issue for me
if not humanoid:IsDescendantOf(workspace) then
return
end
it this case just use this:
while not humanoid:IsDescendantOf(workspace) do
wait()
end
No, this could create an inifinite loop sapping resources if the character never sees the light of day. Also, in my opinion, if a character isn’t spawned while it tries to play an animation it just shouldn’t play at all, not delay it until respawn.
* Also note: You should use the task
library for everything that is included inside over the old, deprecated calls. The task library fixes bugs that occured with the old 30hz pipeline
yeah ive found out what to do about it… this is what ive done:
local character = LocalPlayer.Character
if not character:IsDescendantOf(workspace) then
print("Looking for char in workspace")
local timeout = 5
local timer = 0
repeat
task.wait(0.1)
timer += 0.1
until character:IsDescendantOf(workspace) or timer >= timeout
if character:IsDescendantOf(workspace) then
print("Found char in workspace")
else
warn("Char not found in workspace after timeout, continuing anyway")
end
end
Character can be nil
, which will throw an error for if not character:IsDescendantOf(workspace) then
.
But I still stand by this, it doesn’t make sense to delay animations until respawn. The context is gone.
E.g.: For all we know, it could be the Walking animation being delayed, which playing it on respawn won’t make sense
Also, this warning happens because the character was Destroyed, removed from workspace. You add complexity for an impossible case.
so what do you suggest i do? i want what works the best ofcourse!
I’d suggest to go by my initial fix, we completely suppress this error while keeping the intended behavior
i cam back to this with my method because your initial fix didnt seem to work for me oddly enough… thats why i tried some other things