Hi! I have just recently started to use Profile Service for a game, and when I try to add a new currency to the game, it will not show in the leaderstats.
Here is the code provided:
local Template = {
Gold = 250,
Emeralds = 0,
Level = 1,
XP = 0,
Kills = 0,
}
local ProfileStore = ProfileService.GetProfileStore(
"Player",
Template
)
local Profiles = {}
local function PlayerAdded(plr)
local profile = ProfileStore:LoadProfileAsync(
"Player" .. plr.UserId,
"ForceLoad"
)
if profile then
profile:ListenToRelease(function()
Profiles[plr] = nil
plr:Kick()
end)
if plr:IsDescendantOf(Players) then
local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = "leaderstats"
Profiles[plr] = profile
for i, v in pairs(profile.Data) do
if typeof(v) == "number" then
local new = Instance.new("IntValue", leaderstats)
new.Name = i
new.Value = v
UpdateCurrencies:FireClient(plr, new.Value, new.Name)
new.Changed:Connect(function(val)
UpdateCurrencies:FireClient(plr, val, new.Name)
profile.Data[new.Name] = val
end)
end
end
else
profile:Release()
end
else
plr:Kick()
end
end
The table called Template is the one I want to add currencies too. I have added “Kills” to it and nothing changed in the game, it only shows the other 4. Any ideas on how to add new things to it would be helpful!