Skip to Content

Markers

server

This API is used to send markers to the Gamebeast platform.

local Gamebeast = require(game:GetService("ReplicatedStorage"):WaitForChild("Gamebeast")) local GamebeastMarkers = Gamebeast:GetService("Markers")

:SendMarker(markerType, value, position)

→ void

This method sends a marker with the specified value to Gamebeast.

markerType

string

The name of the marker.

value

number | {[string] : any}

The value of the marker.

position

Vector3?

The optional marker world position for heatmap visualization.

Usage

GamebeastMarkers:SendMarker("RoundEnded", {Score = 600, Map = "Office", Duration = 120}) -- Single value example: GamebeastMarkers:SendMarker("RoundEnded", 600) -- Equivalent to: GamebeastMarkers:SendMarker("RoundEnded", {value = 600})

:SendPlayerMarker(player, markerType, value, position)

→ void

This function sends a marker associated with a specific player to Gamebeast.

player

Player

The player instance associated with the marker.

markerType

string

The name of the marker.

value

number | {[string] : any}

The value of the marker.

position

Vector3?

The optional marker world position for heatmap visualization.

Usage

local Player = game:GetService("Players").Player1 GamebeastMarkers:SendPlayerMarker(Player, "Coins", {Amount = 50, FoundIn = "Lobby"}) -- Single value example: GamebeastMarkers:SendPlayerMarker(Player, "Coins", 50) -- With position GamebeastMarkers:SendPlayerMarker(Player, "Coins", 50, Player.Character.PrimaryPart.Position)

:SendNewPurchaseGrantedMarker(receiptInfo, position)

→ void

This function sends a Purchase marker from a dev product purchase to Gamebeast. This method should be used inside of your game’s MarketplaceService.ProcessReceipt callback whenever a new purchase is granted.

receiptInfo

{[string] : any}

The receiptInfo dictionary from the MarketplaceService.ProcessReceipt callback.

position

Vector3?

The optional marker world position for heatmap visualization.

Usage

local MarketplaceService = game:GetService("MarketplaceService") local DataStoreService = game:GetService("DataStoreService") local PurchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) local success, isPurchaseRecorded = pcall(function() return PurchaseHistoryStore:UpdateAsync(receiptInfo.PurchaseId, function(alreadyPurchased) if alreadyPurchased then return true end -- NOTE: In your experience, you should have more checks. Make sure to look at Roblox's documentation for more information. local success, result = pcall(function() -- Grant the product to the player end) if success then -- Send the purchase marker to Gamebeast only if we've never processed this purchase before. GamebeastMarkers:SendNewPurchaseGrantedMarker(receiptInfo) return true else -- Do not record the purchase if granting the product failed error("Failed to process a product purchase") return nil end end) end) if success == false or isPurchaseRecorded == nil then return Enum.ProductPurchaseDecision.NotProcessedYet else -- IMPORTANT: Tell Roblox that the game successfully handled the purchase return Enum.ProductPurchaseDecision.PurchaseGranted end end

:OnMarkersFailed(callback)

→ RBXScriptConnection

This method fires a callback with a raw list of markers that failed to send to Gamebeast.

callback

(failedMarkers : {{[string] : any}}) -> ()

The callback function that will be fired if markers fail to send.

Usage

GamebeastMarkers:OnMarkersFailed(function(failedMarkers) print("The following markers failed to send to Gamebeast:", failedMarkers) -- Save to DataStore for retrying later, etc. end)

:RetryFailedMarkersAsync(markers)

→ boolean

This method retries sending a list of markers that previously failed to send to Gamebeast.

This method will yeild and return true if the retry was successful, and false if it failed again.

markers

{{[string] : any}}

The list of markers that failed to send. This should be the raw list of markers received from the :OnMarkersFailed callback.

Usage

local FailedMarkersFromDatastore = getFailedMarkers() local success = GamebeastMarkers:RetryFailedMarkersAsync(FailedMarkersFromDatastore) if success then print("Successfully retried failed markers.") else print("Failed to send markers.") end