← All DocsPlayer Segments

Player Segments

Bridge Roblox's native player segments into Baseplate targeting for personalized experiences.

Overview

BaseplatePlayer bridges Roblox's AnalyticsService:GetPlayerSegmentsAsync() into the Baseplate targeting system. This lets you use Roblox's native SpenderStatus, ActivePayerStatus, and Tenure segments as targeting rules in Remote Config and A/B Testing — all controlled from the dashboard.

Quick Start

local BaseplatePlayer = require(game.ServerStorage.Baseplate.BaseplatePlayer)
local BaseplateConfig = require(game.ServerStorage.Baseplate.BaseplateConfig)

game.Players.PlayerAdded:Connect(function(player)
    BaseplatePlayer:TrackJoin(player)

    -- Get full context including Roblox segments
    local ctx = BaseplatePlayer:GetContext(player, { level = 25 })

    -- Use with targeted config
    local price = BaseplateConfig:GetForPlayer("swordPrice", ctx)
    -- Dashboard controls: "show 99 to new players, 149 to whales"
end)

game.Players.PlayerRemoving:Connect(function(player)
    BaseplatePlayer:TrackLeave(player)
end)

API Reference

BaseplatePlayer:GetContext(player, extraFields?) → PlayerContext

Returns a context table with Roblox segments and custom fields. Caches results per player.

FieldSourceExample Values
userIdPlayer.UserId12345678
spenderStatusGetPlayerSegmentsAsync"NeverSpent", "FreeToPlaySpender", "PaidSpender"
activePayerStatusGetPlayerSegmentsAsync"NotActive", "Active"
tenureGetPlayerSegmentsAsync"New", "MidTenure", "Veteran"
isPremiumMembershipTypetrue / false
playtimeTracked since TrackJoin3600 (seconds)
level, etc.Your extraFieldsAnything you pass

BaseplatePlayer:TrackJoin(player)

Call on PlayerAdded to start playtime tracking.

BaseplatePlayer:TrackLeave(player)

Call on PlayerRemoving to clean up cached data.

BaseplatePlayer:GetSegments(player) → table

Returns raw Roblox segments directly from GetPlayerSegmentsAsync.

Using Segments in Targeting Rules

In the Remote Config dashboard, set targeting rules like:

Key: swordPrice
Value: 99
Targeting: spenderStatus == "NeverSpent"

Key: swordPrice
Value: 199
Targeting: spenderStatus == "PaidSpender"

The Luau module evaluates these rules automatically when you call GetForPlayer() with the player context.