So, I planned to have ProfileService that will store all the boolean data on whether the player has these game characters or not. So, I’ve made I profile template that contains all the characters that I have in the game, and gave it a boolean value.
-- This ProfileTemplate contain all the characters that will be in the game, and each
-- player will have their own boolean value whether they have these character or not
local ProfileTemplate = {
Bobby = false;
Loki = false;
Saiyan = false;
Dida = false;
Assasin = false;
}
-- Set up the profileService
local ProfileService = require(game.ReplicatedStorage.ProfileService)
local DictProfileStore = ProfileService.GetProfileStore(
"PlayerHaveTheseCharacters",
ProfileTemplate
)
-- Load data to player when they joined the game
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local profile = DictProfileStore:LoadProfileAsync(
"Player_" .. player.UserId,
"ForceLoad"
)
print(profile.Data.Bobby) -- This will print false
end)
The problem is if I update my game and create a new character named “Newman” and add to the profile template, he will not get added. This is the code box in the same script, but I added new characters and changed it a bit.
-- This ProfileTemplate contain all the characters that will be in the game, and each
-- player will have their own boolean value whether they have these character or not
local ProfileTemplate = {
Bobby = false;
Loki = false;
Saiyan = false;
Dida = false;
Assasin = false;
Newman = false;
}
-- Set up the profileService
local ProfileService = require(game.ReplicatedStorage.ProfileService)
local DictProfileStore = ProfileService.GetProfileStore(
"PlayerHaveTheseCharacters",
ProfileTemplate
)
-- Load data to player when they joined the game
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local profile = DictProfileStore:LoadProfileAsync(
"Player_" .. player.UserId,
"ForceLoad"
)
print(profile.Data.Bobby) -- This will print false
print(profile.Data.Newman) -- This will print nil!? I don't want that... I want the boolean value...
end)
So, I want to know is there any way to achieve my goal using ProfileService. Since this is my first time using ProfileService so I don’t know much. Thanks in advance.