local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ScreenGui = Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
local BillboardGui = script.Parent
RunService.PreRender:Connect(function()
local camera = workspace.CurrentCamera
local adornee = BillboardGui.Adornee :: BasePart
BillboardGui.Size = UDim2.fromOffset(ScreenGui.AbsoluteSize.X, ScreenGui.AbsoluteSize.Y)
adornee.Position = camera.CFrame:PointToWorldSpace(Vector3.new(0, 0, -64))
end)
It flickers and doesn’t always cover up the entire screen (because for some reason it takes some time for Roblox to move the adornee). How can I fix this or are there any workarounds?
I tried all functions that are available, but sadly this lag is still present more or less. I’m thinking about using SurfaceGuis instead and manually aligning the required parts.
This is likely due to how Roblox’s engine defers processes.
BillboardGui instances are also fairly expensive and thus could take more time to process depending on the complexity, so I suspect that these two facts combined are the likely cause for your delay.
I recently implemented a custom chat system in which I built my own bubbles using BillboardGui instances as well, which came with similar challenges.
I’m not sure what alternative or fix I can suggest for you, but I’d like to emphasize again that rendering BillboardGui instances is not cheap. If you’re deadset on using them, do it in moderation or be smart on when and how many are displayed on screen at a time. Surpassing the 31 number you mentioned is already starting to become quite a lot.
I wouldn’t say that. Both are rendering 2D UI in 3D space and they’re not the same as decals or textures because again, they’re UI.
As I haven’t ran into scenarios so far where they’re necessary, I don’t know all that much about them.
I can imagine UIs are constantly being (re)processed in real-time whereas textures are largely memory based?
I would personally only use SurfaceGui instances if the graphics needed to be interactable with the player, because that’s what they’re for.