For about two days, I have been having a weird issue while working on the new update for my game, I have been cleaning up a lot of code and I noticed a weird lag whenever I stopped using a movement ability. If I tried to spam those abilities, my FPS would drop by a lot for the duration of the spam.
By comparing place versions, I was able to find out about this issue being caused by parenting a BillboardGui to the workspace directly and setting its Adornee.
This is what the Microprofiler shows whenever those lag spikes happen:
Destroying a BasePart in a place with a high number of parts while having a BillboardGui parented to the workspace seems to be causing this issue.
Reproduction steps:
- Open the repro file:
BillboardGui Bug.rbxl (170.1 KB) - Playtest
- Use this line of code to create a folder with 10 parts, one part will be destroyed every frame after two seconds:
local folder = Instance.new("Folder", workspace) folder.Name = "Destroy In 2 Seconds" for i = 1, 10 do local part = Instance.new("Part") part.Anchored = true part.Parent = folder end task.wait(2) for _, part in folder:GetChildren() do part:Destroy() task.wait() end folder:Destroy()
While the parts are being destroyed, you will suffer frame drops.
I think this bug is a very obscure one very few people could stumble upon but it took me a lot of efforts to figure out it was caused by simply parenting a BillboardGui to the workspace.
For large games that frequently need to create and destroys parts, this bug would completely ruin the experience and it would be very difficult to find so I believe it’s important to either fix it or mention this issue in the documentation.
System Information:
Intel(R) Core™ i9-9900K CPU @ 3.60GHz
64.0 GB
NVIDIA GeForce RTX 3090