CameraUI is a client-side Luau module for Roblox that allows you to create and manage UI elements that are rendered in 3D space, attached to the camera. It is intended for use on the client; server-side integration is up to the developer.
local CameraUI = require(path.to.CameraUI)
-- Create a new UI measurement controller
local measurement = CameraUI:CreateUIMeasurement()
-- Create a new Camera UI element
local element = CameraUI:CreateUIElement({
name = "MyElement",
distanceAway = 10,
uiElement = myGuiElement, -- Instance of a GuiBase
customPart = nil, -- Optional: custom part to use
customFace = Enum.NormalId.Front, -- Optional: face for SurfaceGui
position = {X = 0, Y = 0}, -- Optional: initial position
rotation = {X = 0, Y = 0, Z = 0} -- Optional: initial rotation
})
Creates a new measurement controller for camera UI.
Creates a new camera UI element.
data: Table with the following fields:
name
(string): Name of the UI elementdistanceAway
(number): Distance from the camera (min 5, max 20)uiElement
(GuiBase, optional): The UI to displaycustomPart
(Part, optional): Custom part to usecustomFace
(Enum.NormalId, optional): Face for SurfaceGuiposition
(table, optional): {X, Y} offsetrotation
(table, optional): {X, Y, Z} rotation in degreesDeleteElement(waitTime)
: Deletes the element after an optional delayGetData()
: Returns internal data for the elementGetPartItself()
: Returns the underlying PartDisconnectLiver()
: Disconnects the RenderStepped connectionSetCFrame(position)
: Sets the X, Y offsetSetRotation(rotation)
: Sets the rotation (X, Y, Z)AddGuiElement(guiElement)
: Adds a GuiBase to the SurfaceGuiSetTransparency(value)
: Sets the part's transparencySetSize(size)
: Sets the part's size (Vector3)TweenUIElement(goalCFrame, tweenInfo)
: Tweens the part to a new CFrameReturns the OOP object for the active element with the given name.