Skip to main content

BadgeUtils

Utility functions involving badges on Roblox

Types

BadgeInfoDictionary

interface BadgeInfoDictionary {
Namestring--

The name of the badge.

Descriptionstring--

The description of the badge.

IconImageIdint64--

The asset ID of the image for the badge.

IsEnabledbool--

Indicates whether the badge is available to be awarded.

}

Functions

promiseAwardBadge

This item only works when running on the server. Server
BadgeUtils.promiseAwardBadge(
playerPlayer,
badgeIdnumber
) → Promise

Tries to reward a player to a badge inside of a promise.

promiseBadgeInfo

BadgeUtils.promiseBadgeInfo(badgeIdnumber) → Promise<BadgeInfoDictionary>

Gets the badge info for the given badgeId.

promiseUserHasBadge

BadgeUtils.promiseUserHasBadge(
userIdnumber,
badgeIdnumber
) → Promise<BadgeInfoDictionary>

Returns true if the uesr has the badge

Show raw api
{
    "functions": [
        {
            "name": "promiseAwardBadge",
            "desc": "Tries to reward a player to a badge inside of a promise.",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "badgeId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 31,
                "path": "src/badgeutils/src/Shared/BadgeUtils.lua"
            }
        },
        {
            "name": "promiseBadgeInfo",
            "desc": "Gets the badge info for the given badgeId.",
            "params": [
                {
                    "name": "badgeId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<BadgeInfoDictionary>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 54,
                "path": "src/badgeutils/src/Shared/BadgeUtils.lua"
            }
        },
        {
            "name": "promiseUserHasBadge",
            "desc": "Returns true if the uesr has the badge",
            "params": [
                {
                    "name": "userId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "badgeId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise<BadgeInfoDictionary>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 81,
                "path": "src/badgeutils/src/Shared/BadgeUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "BadgeInfoDictionary",
            "desc": "",
            "fields": [
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": "The name of the badge."
                },
                {
                    "name": "Description",
                    "lua_type": "string",
                    "desc": "The description of the badge."
                },
                {
                    "name": "IconImageId",
                    "lua_type": "int64",
                    "desc": "The asset ID of the image for the badge."
                },
                {
                    "name": "IsEnabled",
                    "lua_type": "bool",
                    "desc": "Indicates whether the badge is available to be awarded."
                }
            ],
            "source": {
                "line": 22,
                "path": "src/badgeutils/src/Shared/BadgeUtils.lua"
            }
        }
    ],
    "name": "BadgeUtils",
    "desc": "Utility functions involving badges on Roblox",
    "source": {
        "line": 5,
        "path": "src/badgeutils/src/Shared/BadgeUtils.lua"
    }
}