PlayerUtils
Provides utility functions for working with players.
Functions
OnPlayerAdded
PlayerUtils:OnPlayerAdded(callback: function,--
The callback to invoke when a player joins
callbackName: string?--
The name of the callback (optional)
) → ()Add a callback for any player, existing and future, that joins.
PlayerUtils:OnPlayerAdded(function(player, playerMaid)
print(`Hello, {player.Name}!`)
end, "CallbackName")
RemoveJoinCallback
PlayerUtils:RemoveJoinCallback(callbackName: string--
The name of the callback to remove
) → ()Remove a spawn callback by name.
PlayerUtils:RemoveJoinCallback("CallbackName")
GetPlayerMaid
PlayerUtils:GetPlayerMaid() → Maid--
The PlayerMaid for the player
Returns the maid associated with a specific player, which cleans up when the player disconnects.
FetchUserInfo
This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts. YieldsPlayerUtils:FetchUserInfo(userId: number--
The UserId to get the user info from
) → UserInfo?--
The user's info
Types
interface UserInfo {Id: numberUsername: stringDisplayName: stringHasVerifiedBadge: boolean}Fetch the user info for the user with the specified UserId from the Roblox website.