Skip to content

Frontend

Many modules for controlling the Administer Frontend.

Frontend.ToggleFullscreen

Toggles the Fullscreen state of the panel. You shouldn't be doing this for fun, the user should be in full control at all times.

luau
Frontend.ToggleFullscreen(
    ForceClose: boolean
): ()
luau
Var.Services.UserInputService.InputBegan:Connect(function(KeyCode, IsGameProc)
	if IsGameProc then return end

	if KeyCode.KeyCode == Enum.KeyCode.F2 then
		if Var.Services.UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
			Frontend.ToggleFullscreen()
        end
    end
end)

Frontend.Open

Forces the panel. Optionally yields with WaitForCompletion. If Var.UseAcrylic is enabled, the acrylic effect is created on the Var.MainFrame target.

luau
Frontend.Open(
    WaitForCompletion: boolean?
)
luau
Var.Remotes.OpenPanel.OnClientEvent:Connect(Frontend.Open)

Frontend.Open

Closes the panel. If Instant: true, the animation will be bypassed.

If Frame is passed, the animation will be played on that frame instead of Var.MainFrame.

luau
Frontend.Close(
    Instant: boolean?,
    WaitForCompletion: boolean?
)
luau
game.Players.LocalPlayer.Chatted:Connect(function(c)
    if c == "/close" then
        Frontend.Close(false, false)
    end
end)

Frontend.Drawer.Open

Opens the App Drawer. If Var.DoHeaderEffects is not true or if a popup is open, then the call is dropped and ignored.

luau
Frontend.Drawer.Open(): ()
luau
script.Parent.MouseButton1Click:Connect(Frontend.Drawer.Open)

Frontend.Drawer.Close

Closes the app drawer.

luau
Frontend.Drawer.Close(): ()
luau
script.Parent.MouseButton1Click:Connect(Frontend.Drawer.Close)

Frontend.Drawer.HoverBegin

Small animation on the app drawer button to show that there is something there

luau
Frontend.Drawer.HoverBegin(): ()
luau
script.Parent.MouseOver:Connect(Frontend.Drawer.HoverBegin)

Frontend.Drawer.HoverEnd

Same as above, but instead it gets rid of the icon

luau
Frontend.Drawer.HoverEnd(): ()
luau
script.Parent.MouseLeave:Connect(Frontend.Drawer.HoverEnd)

User Interfaces

For more information, please see the Interfacing with the end user guide.

Frontend.Toast

Creates a Toast element and displays it to the user.

luau
Frontend.Toast(Config: {
    Text: string,
	Subtext: string,
	Icon: string,
	Timeout: number,

	OnClick: () -> ()?
})
luau
Frontend.Toast({
	Icon = Utilities.Icon "clock-past",
	Text = "Client initialization complete!",
	Subtext = "Done in 534ms",
	Timeout = 7,
	OnClick = function()
		print("ok")
	end
})

Frontend.Popup.new

Creates a new popup.

luau
Frontend.Popup.new(
    	App: {
		Name: string,
		Subheader: string,
		Icon: string
	},

	Icons: {
		Primary: string,
		SubIcon: string?
	},

	Header:     string,
	BodyText:   string,

	Options: { 
		{ 
			Text: string, 
            Icon: string,
            Callback: (Close: () -> (), TextInputChoices: { string? }) -> () 
		}
	},

	TextInputs: { 
		{ 
			HeaderText: string 
		}
	}
): { boolean, string }?
luau
Frontend.Popup.new(
    {
        Name = "Player Management",
        Icon = Utilities.Icon "users",
    },
    {
        Primary = PlayerBasic.Photo,
        SubIcon = Utilities.Icon "warning-triangle"
    },

    `Unban @{PlayerBasic.Username}`,
    "Are you sure you would like to end this players ban early? They will be able to join the game normally again.",
    {
        {
            Text = "Yes",
            Icon = Utilities.Icon "warning-filled",
            Callback = function(Close, Text)
                print(Remotes.ServerComm:InvokeServer("UnbanPlayer", {
                    TargetID = PlayerID,
                    AuditLogMessage = Text[1] 
                }))

                Close()
                LoadPlayer(PlayerID, ServerJobID)
            end
        },
        {
            Text = "No",
            Icon = Utilities.Icon "x",
            Callback = function(Close)
                Close()
            end
        }
    },
    {
        {
            HeaderText = "Reason"
        }
    }
)

Frontend.Popup.Close

Forcibly close a popup while bypassing the Close callback function.

luau
Frontend.Popup.Close(): ()
luau
Frontend.Popup.Close()

Frontend.Popup.Open

Same thing as above, but it opens instead of closes. May cause user confusion if used too frequently as data will not be updated.

luau
Frontend.Popup.Open(): ()
luau
Frontend.Popup.Open()

Frontend.SwapAppBasic

Swaps the currently active frame for a new one.

luau
Frontend.SwapAppBasic(
    NewFrame: Frame | CanvasGroup,
    NewConfig: {
        Name: string,
        Icon: string
    }
): ()
luau
Frontend.SwapAppBasic(
    Var.MainFrame.Welcome,
    {
        Name = "Welcome to Administer!",
        Icon = Utilities.Icon "wave"
    }
)

Frontend.SwapApps

Like the previous function, but instead takes an AppConfig object.

luau
Frontend.SwapApps(
    AppConfig: {
        Icon: string,
        AppName: string,
        Background: string,
        Description: string,
        
        MainButtonClick: () -> (),
        MainButtonFrame: Frame | CanvasGroup?,
        ButtonID: string,

        SubIcons: {
            {
                Icon: string,
                Name: string,
                Frame: Frame | CanvasGroup,
                Click: () -> (),
                
                ButtonID: string
            }
        }
    },
    ClickedSubapp: number
)
luau
Clone.Activator.MouseButton1Click:Connect(function()
    task.defer(Frontend.Drawer.Close)

    Frontend.SwapApps(ButtonConfig, Index, Clone)

    xpcall(Icon.Click, Utilities.Logging.Warn)
end)

Frontend.InitGestureBar

Registers functions for the gesture bar.

WARNING

This is probably not useful for your code and you should not use it.

[Deprecation notice]

This method is deprecated and no longer returns any data. It will be removed soon and should not be used for new Apps.

This API has been superseded by Frontend.SpawnOverlay.

Deprecation in: Administer 2.1.0 API Removal in: Administer 2.2.0

luau
Frontend.InitGestureBar(): ()
luau
Frontend.InitGestureBar()

Frontend.SpawnOverlay

Spawns an Administer generated overlay for a frame.

WARNING

Do not just run this for any frame, it will break Administer's window manager. It should only be used for frames parented to the root ScreenGUI.

luau
Frontend.SpawnOverlay(
    Frame: Frame | CanvasGroup
): ()
luau
local NewFrame = Instance.new("Frame")

NewFrame.Parent = Var.MainFrame.Parent

Frontend.SpawnOverlay(Frame)

Frontend.RegisterPanelKeybind

Loads core keybind-related settings and binds events.

WARNING

This is probably not useful for your code because it does not return data.

luau
Frontend.RegisterPanelKeybind(): ()
luau
Frontend.RegisterPanelKeybind()

Frontend.AddButtonAnimation

Initializes a button animation (hover, click, haptics, and ripple effects) for a requested button.

luau
Frontend.AddButtonAnimation(
    Button: TextButton | ImageButton
)
luau
Frontend.AddButtonAnimation(Instance.new("TextButton", script.Parent))

Frontend.PrepTheme

Prepares the Var.MainFrame to be styled by color snapping and adding attributes. In order to use Frontend.LoadTheme, this must be called first.

luau
Frontend.PrepTheme()
luau
Frontend.PrepTheme()

Frontend.LoadTheme

Loads a theme based off its theme configuration file.

INFO

This API is only valid on Administer 2.2.0 or later, which is not yet generally available. Further documentation for themes will be added when an API schema is set in stone.

luau
type Color = {
    Color: Color3,
    Transparency: number
}

Frontend.LoadTheme(
    ThemeConfig: {
        Name: string,
        Author: {
            Name: string,
            ID: number
        },

        IsDark: boolean,
        EnableAcrylic: boolean,

        Colors: {
            Background: {
                Primary: Color,
                Header: Color,
                Panel: Color,
                Card: Color,
                Modal: Color
            },

            Text: {
                Important: Color,
                Primary: Color,
                Secondary: Color,
                Subtle: Color
            },

            Buttons: {
                IconButton: Color,
                SquareButton: Color
            },

            Colors: {
                Accent: Color,
                Red: Color,
                Orange: Color,
                Green: Color,
                Shimmer: Color
            }
        },

        OnStyle: () -> (),
        Selected: () -> ()
    }
)
luau
Frontend.PrepTheme(require(script.Parent.DefaultLight))