Billboard GUIs used to display NPC information overhead seems to be causing large amounts of lag. In the gif above I get around ~35 FPS while billboard GUIs are enabled, and when disabled I get ~120 FPS. The FPS can be seen in the bottom right corner of the gif. (The framerate and resolution of the gif doesn’t help )
I don’t believe the problem is caused by scripts because all I am doing is toggling the visibility of the billboard GUIs which drastically improves the FPS.
I also tried disabling certain billboard GUIs one at a time, and none in particular would improve FPS dramatically.
Here is the script used to toggle the billboard GUIs.
local function ToggleHeadUi(Target)
if Target then
if Target:FindFirstChild("Head") then
for _,v2 in pairs(Target.Head:GetChildren()) do
if v2:IsA("BillboardGui") then
if v2.Enabled == true then
v2:SetAttribute("ReEnable",true)
v2.Enabled = false
end
end
end
end
end
end
for _,v in pairs(Players:GetChildren()) do
local Target = game.Workspace:FindFirstChild(v.Name)
ToggleHeadUi(Target)
end
for _,v in pairs(game.Workspace.EnemyList:GetChildren()) do
local Target = game.Workspace:FindFirstChild(v.Name)
ToggleHeadUi(Target)
end
Here is another clip from a tester showing the FPS difference and lag toggling the billboard GUI causes.
Well I don’t feel like that’s gonna change much, especially in situations where a large amount of NPCs will be attacking you, so all of their info will be displayed anyways. I’d rather get to the root of the problem and not have this lag at all for any situation.
Yeah lowering the distance helps with the lag, but it’ll still be laggy when your camera is zoomed in close to enemies, and or a lot of enemies are swarming you nearby.
UPDATE:
I tried setting the .Visible property of all frames in the billboard GUI to false making all the UI invisible, but that still resulted in lag.
I also played around with the Size property of the billboard GUI. When size is 0, there’s no lag because the UI is not able to be shown. When size is 0.001 there’s also no lag. When size is 0.1 and the UI is barely visible the lag is still present and doesn’t improve.
Do you really plan for there to be THAT many enemies attacking you? This is just a limitation of roblox, i dont think theres anything to do aside from hiding it and only showing it when its necessary. If you plan to have that many enemies then you gotta expect to have to optimize things HEAVILY. Otherwise, expect to frequently drop down to 1fps.
It is planned for situations with around 30+ enemies to be attacking at once. So I find it really concerning that only the GUI itself is causing this much lag. I’d really want to not have this lag coming from GUI at all. But from testing, it does seem like a Roblox issue and I’ll be trying to submit a engine bug later.
Here is an isolated test on a baseplate. Without billboard GUI enabled I get around ~200 FPS. With them enabled I get around ~90 FPS even though the billboard GUI only consists of a Frame and a TextLabel. It’s a pretty huge FPS drop.
so if you go to a baseplate (like you just did) and the lag is a lot less than when you’re inside the main game, are you even sure that the problem is with the Gui’s?
Well yeah the lag is less because there’s nothing else happening. But the GUIs themselves are causing FPS to go from 200 > 90 on the baseplate. So I’m very sure lag is coming from the GUIs.