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.
| Field | Source | Example Values |
|---|---|---|
userId | Player.UserId | 12345678 |
spenderStatus | GetPlayerSegmentsAsync | "NeverSpent", "FreeToPlaySpender", "PaidSpender" |
activePayerStatus | GetPlayerSegmentsAsync | "NotActive", "Active" |
tenure | GetPlayerSegmentsAsync | "New", "MidTenure", "Veteran" |
isPremium | MembershipType | true / false |
playtime | Tracked since TrackJoin | 3600 (seconds) |
level, etc. | Your extraFields | Anything 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.