Appearance
PlayerState Documentation β
A robust, type-safe player data management system for ROBLOX games using ProfileStore and Replica services.
Created by bellaouzo - A powerful solution for managing player data in ROBLOX games that utilizes Replica and ProfileStore.
Features β
Get: 2.2M/secSet: 478K/secGetPath: 2.1M/secSetPath: 488K/sec
- Type Safety: Full TypeScript-style type annotations
- Real-time Sync: Automatic client-server data synchronization
- Persistent Storage: ProfileStore integration for reliable data persistence
- Path-based Access: Easy nested data manipulation with dot notation
- Event System: Listen for data changes with callbacks
- Array & Dictionary Operations: Built-in helpers for collections
Quick Start β
lua
local PlayerState = require(ReplicatedStorage.Libraries.PlayerState.PlayerStateServer)
-- β οΈ CRITICAL: You MUST have this PlayerAdded connection!
game.Players.PlayerAdded:Connect(function(player)
PlayerState.Init(player) -- β ESSENTIAL - PlayerState won't work without this!
end)
-- Set player coins (after Init)
PlayerState.Set(player, "Coins", 1000)lua
local PlayerState = require(ReplicatedStorage.Libraries.PlayerState.PlayerStateClient)
-- Get player coins
local coins = PlayerState.Get("Coins")
-- Listen for changes
PlayerState.OnChanged("Coins", function(newValue, oldValue)
print("Coins updated:", newValue)
end)Ready to Go!
The Roblox model includes all dependencies - just download and use!
Architecture β
PlayerState uses a server-authoritative architecture:
Key Components:
- Server: Manages all data modifications using ProfileStore for persistence
- Client: Read-only access with real-time updates via Replica
- Synchronization: Automatic bi-directional sync between server and clients
Dependencies β
- ProfileStore - Data persistence
- Replica - Real-time synchronization
- DefaultData module - Data schema definition
- PlayerStateConfig module - Centralized configuration settings
NOTE
All dependencies are included in the Roblox model! No manual installation needed.
Getting Started β
- Installation - Add to your project
- Setup - Configure the module and PlayerStateConfig settings
- API Reference - Complete function documentation
- Examples - Common usage patterns
PlayerState V1
This is PlayerState V1 - production-ready with active development. Updates include new features, optimizations, and community-requested improvements. Your feedback shapes future versions!
Recent updates β
- New: Added a new client function
GetLeaderboardInfo(statName)to easily get your current leaderboard rank and score for a stat. - Fixed: A small cache cleanup issue on the client.
- Improved: Leaderboard updates so players get up-to-date info sooner (no βwait for the next intervalβ feeling).
- New: Synced each playerβs current leaderboard info to the client, so UIs can show rank/score more reliably.
- Improved: Scores feel instant: when a tracked stat changes, the displayed leaderboard score updates right away; the rank updates on the normal refresh cycle.
- Note: Leaderboard display data is treated as temporary and wonβt be saved into player data.