PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

SetTopbarTransparency

SetTopbarTransparency sets the transparency of the Topbar CoreGui. A value of 0 is completely opaque, and a value of 1 is completely transparent. Values outside of the range [0, 1] are clamped. The default transparency of the topbar is 0.5. The current transparency can be retrieved using the similarly-named PlayerGui/GetTopbarTransparency|GetTopbarTransparency function.

Comparison of Values

The screenshots below show the topbar at 1.0, 0.5 and 0.0 transparency.
The TopBar with a transparency of 1.0 (completely hidden)] The TopBar with a transparency of 0.5 (50% transparency)] The TopBar with a transparency of 0.0 (completely opaque)

Usage

This method is often used when re-styling the topbar to match the visual aesthetic of a game. By hiding the topbar, you can create your own custom topbar. See the code samples for an example.

Alternative

Using the StarterGui/SetCore method with the TopbarEnabled option allows you to enable/disable the entire topbar and all of its features (player list, health, etc). By contrast, this method only affects how the topbar is displayed.

Parameters

Name Type Default Description

Returns

Return Type Summary

Code Samples


Custom Topbar Style

This code sample demonstrates how you can create a custom-styled topbar. Paste it into a LocalScript placed within StarterPlayerScripts. First, hide the default topbar by setting its transparency to 1 (using PlayerGui/SetTopbarTransparency). Then, recreate the topbar Frame and parent it to a ScreenGui. Set the styles on the Frame to your liking, such as GuiObject/BackgroundColor3 or GuiObject/BackgroundTransparency. Below is a screenshot of what the topbar will look like after this code sample is run.

The Topbar customized to appear dark blue


PlayerGui:SetTopbarTransparency

The following line of code makes the Topbar appear fully opaque.