I’m currently experiencing large FPS drops in my game due to “updateInvalidatedFastClusters”. This occurs only in first person, which I’m pretty sure is because this is when my game’s viewmodel is enabled which uses the player’s characters arms.
What I do is the viewmodel’s Motor6Ds connects to the character’s corresponding limbs while in first person, and the viewmodel’s shoulder transforms match the actual shoulder transforms:
Is there a known fix for this? My current options are:
Make a bug report and wait for a fix, which I dont want to have to do
Find a workaround
Change how I’m handling my viewmodel (maybe don’t use the player’s actual character arms but instead a copy)
Extra:
I tried having the viewmodel enabled even while in 3rd person, and look:
My FPS is perfectly fine. So it has something specifically to do with being in first person? The only thing I can think of is I’m forcing the character’s arms to stay opaque:
It’s fixed. So this means the FPS drop is because of setting the character’s arm transparency. Which this is weird because from my knowledge this is a common tactic, so this FPS drop must be common for other people too?
I’m going to look at workarounds for this and reply when I find a fix for anyone who finds this in the future
Alright, I found a fix. For anyone who doesn’t want to read the entire post, the problem was forcing the character’s arms to be opaque every frame, like so:
The fix I found is to simply not allow Roblox to make your character transparent in the first place. You can do this by setting the camera subject to the player’s head:
Which doesn’t allow the core scripts to force the character transparent, and now you just need to manually set the limbs you want to be transparent while in first person:
And the problem is fixed! I’m very happy with this since it’s not a crazy workaround. The only caveat I’ve found is that the character now doesn’t turn with the camera in first person, but this isn’t too difficult of a fix (and could actually be desirable if you’d prefer to do it yourself anyways)
Here’s my code for manually toggling the character’s transparency:
--!strict
local ALLOWED_LIMB_NAMES = {"Head", "Torso", "Left Leg", "Right Leg"}
local function toggleCharacterFirstPersonTransparency(Model: Model, Toggle: boolean)
for _, Child in Model:GetChildren() do
if Child:IsA("Accessory") then
for _, Sub in Child:GetChildren() do
if Sub:IsA("BasePart") then
Sub.LocalTransparencyModifier = Toggle and 1 or 0
end
end
elseif Child:IsA("BasePart") and table.find(ALLOWED_LIMB_NAMES, Child.Name) then
Child.LocalTransparencyModifier = Toggle and 1 or 0
end
end
end
return toggleCharacterFirstPersonTransparency