So i’m trying to use Profile Service to save data for the first time and i wanted to make leaderstats, but it seems like the leaderstats folder isn’t creating even though i don’t have any errors in the output.
Also i DO have the API services enabled.
This is my Data Manager module script :
local Players = game:GetService("Players")
local serverScriptService = game:GetService("ServerScriptService")
local modules = serverScriptService:WaitForChild("Modules")
local ProfileService = require(modules:WaitForChild("ProfileService"))
local template = require(script:WaitForChild("Template"))
local leaderstats = require(script:WaitForChild("Leaderstats"))
local dataKey = "DataStore"
local profileStore = ProfileService.GetProfileStore(dataKey, template)
local dataManager = {}
dataManager.Profiles = {}
local function PlayerAdded(player: Player)
local profile = profileStore:LoadProfileAsync("Player_"..player.UserId)
if profile ~= nil then
profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
dataManager.Profiles[player] = nil
player:Kick()
end)
if player:IsDescendantOf(Players) then
dataManager.Profiles[player] = profile
leaderstats:Create(player, profile)
end
end
end
return dataManager
This is my leaderstats module script :
local LeaderstatsModule = {}
function LeaderstatsModule:Create(player: Player, profile)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue", leaderstats)
coins.Name = "Coins"
coins.Value = profile.Data.Coins
local diamonds = Instance.new("IntValue", leaderstats)
diamonds.Name = "Diamonds"
diamonds.Value = profile.Data.Diamonds
local rebirths = Instance.new("IntValue", leaderstats)
rebirths.Name = "Rebirths"
rebirths.Value = profile.Data.Rebirths
end
return LeaderstatsModule
And this is my Template script :
local Template = {
Coins = 0;
Diamonds = 0;
Rebirths = 0;
Backpack = {};
Zones = {}
}
return Template
Also the server script just requires so there’s no point of showing that.
Any help would be appreciated so much!