I am implementing an elo system using leaderstats. I want to set the players’ elo leaderstat to 400 only once ever. I do not really know where to start with this.
1 Like
The following code I assumed that the data stored in storeName only contains the eloValue
local dataStore = game:GetService("DataStoreService");
local Players = game:GetService("Players");
local storeName = dataStore:GetDataStore("TestServerStore"); -- Change Store Name Here
Players.PlayerAdded:Connect(function(player)
local success,data = pcall(function()
return storeName:GetAsync(player.UserId); -- return nil if no data found
end)
if success then
if not data then
-- Implement Code to Set Stat to 400
else
-- Implement Code to Set Stat to what the Data Has
end
end
end)