Roblox SDK
Use this section to review required setup functions and examples for the Roblox SDK.
Refer to the Intallation section for installation information.
Calling into Gamebeast from Roblox
-- Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Gamebeast = require(ReplicatedStorage:WaitForChild("Gamebeast"))
Gamebeast:Setup({
key = "abcd-efgh-1234-5678",
})-- Client Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Gamebeast = require(ReplicatedStorage:WaitForChild("Gamebeast"))
Gamebeast:Setup()IMPORTANT: Tracking Dev Product purchases
If you are using Dev Products in your game, it is highly recommeded to implement the :SendNewPurchaseGrantedMarker method to track purchases accurately.
SDK Usage Considerations
Do not clear the shared global table.
Gamebeast's Roblox SDK uses shared.GBMod to fetch modules within its internal framework. Clearing this table will result in the SDK erroring during startup.
It's okay to add additional entries to shared as long as GBMod is not overwritten.
It is unsafe to change the SDK's source.
The SDK is designed to be a black box, modifying its source code can lead to unexpected behavior. Changes will not be preserved when the plugin updates the SDK. If you're interested in additional functionality, please reach out.
Default Behaviors
Default Markers
The SDK will automatically send certain default markers to help track player activity in your experience. These include things like player joins, leaves, and place teleports.
For a full list of default markers sent by the Gamebeast Roblox SDK, view the dropdown below:
View Default Markers
Login
Triggered when a player logs in to your experience.
This does not include when joining from a teleport within the same experience, such as teleporting to the main place from the lobby place.
Arguments:
policyInfo{[string] : any}the policy information of the player retrieved from
PolicyService:GetPolicyInfoForPlayerAsync()
Logout
Triggered when a player leaves your experience. This does not include leaving by teleports to places within the same experience.
Arguments:
sessionLengthnumberThe length of the player's session in seconds across all places in the experience.
sessionLengthPercentageWithFriendsnumberA 0-1 representation of the percentage of the player's session spent with friends.
JoinedUser
Triggered when a player joins another player in your experience.
Arguments:
userIdnumberThe ID of the user that the player joined.
isFriendbooleanWhether the user that the player joined is a friend.
PlaceTeleport
Triggered when a player teleports to a different place within your experience.
Arguments:
sourcePlaceIdnumberThe ID of the place the player is teleporting from.
destinationPlaceIdnumberThe ID of the place the player is teleporting to.
sessionLengthnumberThe length of the player's session in seconds within that place.
Purchase
Triggered when a player makes a purchase in your experience, such as buying a developer product, game pass, asset, or subscription.
Arguments:
typestringThe type of purchase made by the player. This can be set to gamepass, asset, devproduct or
subscription.
fromReceiptbooleanWhether or not this purchase marker was made from the receipt of a purchase via
MarkersService:SendNewPurchaseGrantedMarker()
idnumberThe Roblox provided identifier for the purchased item.
pricenumberThe price of the purchased item. This is the price the player paid, which may differ from the base price if discounts are applied from Roblox's geographic pricing.
basePricenumberThe default price of the purchased item.
namestringThe name of the purchased item.
descriptionstringThe description of the purchased item.
imageIdstringThe image URL of the purchased item.
Chat
Triggered when a player sends a chat message in your experience.
Arguments:
messagestringThe chat message sent by the player.
SDK Methods
local Gamebeast = require(game:GetService("ReplicatedStorage"):WaitForChild("Gamebeast")):Setup(setupConfig)
voidreturn type
This function must be called once on the server and client to initialize the Gamebeast SDK.
Attempting to call any other SDK method before calling :Setup will result in an error.
setupConfigServerSetupConfig?The required config table for the SDK.
Types
type SDKSettings = {
-- Enables SDK warnings for API misuse, internal errors, etc.
sdkWarningsEnabled : boolean,
-- Enables stack trace inclusion with warning messages.
includeWarningStackTrace : boolean,
}
type ServerSetupConfig = {
key : string | Secret,
sdkSettings : SDKSettings?
}Usage
-- Server
Gamebeast:Setup({
key = "abcd-efgh-1234-5678",
sdkSettings = {
sdkWarningsEnabled = true,
includeWarningStackTrace = false,
}
})
-- Client
Gamebeast:Setup()if sdkSettings is not provided, the following are the defaults that will be used.
{
sdkWarningsEnabled = true,
includeWarningStackTrace = false,
}:GetService(serviceName)
GamebeastServicereturn type
This method will attempt to fetch a service module from the Gamebeast SDK. All available services can be found documented here.
serviceNamestringThe name of the SDK service.
Usage
GamebeastMarkers = Gamebeast:GetService("Markers") :: Gamebeast.MarkersService