Using the name of the label UpdateGeometry as a point of assumption, I can assume that there is something interaction-heavy regarding parts in your game. Are you aware of any intensive codebase having to do with parts? Doesn’t matter where they are, ViewportFrames count as well (though they’re typically static post-render).
So what happens is that, my game has a cutscene system and each client has their own NPC but are controlled server sided, and to avoid clients from seeing other client’s NPCs, my replication manager module locally removes them so all clients only see their own NPC.
remoteReplicationManager.OnClientEvent:Connect(function(child, parent)
if child then
child.Parent = parent;
if parent == nil then
local humanoid = child:FindFirstChildWhichIsA("Humanoid");
if humanoid then humanoid.Parent = workspace; end
end
end
end)
I recently added this section of the code:
if parent == nil then
local humanoid = child:FindFirstChildWhichIsA("Humanoid");
if humanoid then humanoid.Parent = workspace; end
end
And it seems to be the cause of the lagspike, framerate issue and weird lighting issue. I added this section is so that server will stop trying to play an animation on a dead humanoid, normally it just spams the client console with Humanoid has to be a descendant of workspace to play animation.
However, what I don’t understand is why is this causing the client to have the issues?
Humanoids are relatively hacky and expensive by nature of their backend code. Adding a Humanoid to the Workspace does cause unexpected issues: avoid parenting the Humanoid to the Workspace.
I’m not too sure why you need to push the Humanoid to the workspace. You can use pcall before playing an animation if an edge case such as playing animations on a dead humanoid come up. This’ll prevent the error from showing and the script from terminating.