Skip to main content

PlayerUI

This item only works when running on the client. Client

This is a MapLib Feature. It can be accessed by MapLib:GetFeature("PlayerUI").

Functions

LoadUI

This item only works when running on the client. Client
since 0.11
</>
PlayerUI:LoadUI(guiScreenGui) → ()

This function can be used to load a ScreenGui from the map into the players PlayerGUI.

Example:

-- Loads an UI for everyone in the round
local PlayersFeature = MapLib:GetFeature("Players")
local PlayerUI = MapLib:GetFeature("PlayerUI")

local ui = map:WaitForChild("MyGUI")

for _, player in pairs(PlayersFeature:GetPlayers()) do
	if player and player.Character then
		PlayerUI:LoadUI(ui)
	end
end
Show raw api
{
    "functions": [
        {
            "name": "LoadUI",
            "desc": "This function can be used to load a `ScreenGui` from the map into the players PlayerGUI.\n\n**Example:**\n```lua\n-- Loads an UI for everyone in the round\nlocal PlayersFeature = MapLib:GetFeature(\"Players\")\nlocal PlayerUI = MapLib:GetFeature(\"PlayerUI\")\n\nlocal ui = map:WaitForChild(\"MyGUI\")\n\nfor _, player in pairs(PlayersFeature:GetPlayers()) do\n\tif player and player.Character then\n\t\tPlayerUI:LoadUI(ui)\n\tend\nend\n```",
            "params": [
                {
                    "name": "gui",
                    "desc": "",
                    "lua_type": "ScreenGui"
                }
            ],
            "returns": [],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "since": "0.11",
            "source": {
                "line": 61,
                "path": "src/Features/PlayerUI.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PlayerUI",
    "desc": "This is a MapLib Feature. It can be accessed by `MapLib:GetFeature(\"PlayerUI\")`.",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 20,
        "path": "src/Features/PlayerUI.lua"
    }
}