npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rbxts/playfab

v2.1.9

Published

A PlayFab SDK for Roblox. PlayFab is a complete backend platform for live games with managed game services, real-time analytics, and LiveOps.

Downloads

31

Readme

About

This SDK provides complete access to the entire PlayFab API on Roblox. It supports both Lua and TypeScript (for roblox-ts users), using type declaration files. I highly recommend using TypeScript with this project if you can. The entire PlayFab API is fully typed, and it makes working with the API a lot easier.

All SDK source files are generated automatically based on PlayFab's API schema, which makes updating to recent API updates incredibly fast and gives less room for human error.


What is PlayFab?

PlayFab is a complete backend platform for live games with managed game services, real-time analytics, and LiveOps.

PlayFab's backend services reduce the barriers to launch for game developers, offering both large and small studios cost-effective development solutions that scale with their games and help them engage, retain and monetize players. PlayFab enables developers to use the intelligent cloud to build and operate games, analyze gaming data and improve overall gaming experiences.

To use PlayFab features, you must sign up for a PlayFab account. The PlayFab documentation is available here.


Installation

The preferred way to use this SDK is via roblox-ts and Rojo. However, it still has first-class support for Lua, should you be using it. For those using Typescript, the entire PlayFab API is fully typed and documented, supporting powerful IntelliSense in your favourite editor.

People not using Rojo can download the latest model file form the releases section, but this might not always be the most up-to-date version.

Here are installation instructions for both Typescript and Lua. You will find that each section which involves code will have this.


Getting credentials

Getting your PlayFab title's credentials is simple! You should refer to this guide for the Title ID and this for your Secret Key!


Basic usage

TypeScript

import { Players } from '@rbxts/services'
import { Settings, PlayFabClient } from '@rbxts/playfab'

Settings.devSecretKey = '' // Put the secret key that you copied from the above section here
Settings.titleId = '' // Put the title ID that you copied from the above section here

Players.PlayerAdded.Connect(async player => {
    // Log client in
    // This must be async and no "client-side" methods can be used until this has returned.
    PlayFabClient.LoginWithCustomID({
        CreateAccount: true,
        CustomId: tostring(player.UserId) // You can use your own CustomId scheme
    }).then(async loginResult => {
        const token = loginResult.EntityToken!.EntityToken!
        const ticket = loginResult.SessionTicket!

        // You are ready to go!
        const profile = await PlayFabClient.GetPlayerProfile(ticket)
        print(profile)
    })
})

Lua

local PlayFab = require(path.to.PlayFab)
local Settings = PlayFab.Settings
local Client = PlayFab.PlayFabClient

Settings.devSecretKey = '' -- Put the secret key that you copied from the above section here
Settings.titleId = '' -- Put the title ID that you copied from the above section here

game.Players.PlayerAdded:Connect(function(player)
    -- Log client in
    -- This must be async and no "client-side" methods can be used until this has returned.
    Client:LoginWithCustomID({
        CreateAccount = true, -- Create an account if one doesn't already exist
        CustomId = tostring(player.UserId) -- You can use your own CustomId scheme
    }):andThen(function(loginResult)
        local entityToken = loginResult.EntityToken.EntityToken
        local sessionTicket = loginResult.SessionTicket

        -- You are ready to go!
        Client:GetPlayerProfile(sessionTicket):andThen(function(profile)
            print(profile)
        end)
    end)
end)

Notes and Best Practices

  • Make sure you have HttpEnabled toggled on in HttpService! This SDK relies on HTTP requests.
  • This SDK should not be used from the client. "Client-side" APIs should still run on the server but should have the clients SessionTicket or EntityToken passed to them.
  • A SessionTicket and EntityToken can expire after a period of time. You should design your system with this in mind and be able to log the client back in, should one expire.
  • You should store each players SessionTicket and EntityToken in a centralized store, like Rodux, so that they can be accessed by any script that needs them.
  • Almost all PlayFab SDK documentation applies here as well. It would be best if you referred to the official PlayFab documentation and forums before making an issue for this SDK.

Documentation

Documentation for this SDK is available at gril.me/RobloxPlayFabSDK.