i was trying to mess around with datastores for the first time and i was using it to make my game’s ability swapping system, i needed it to store the current ability group, but for some reason it appears to not be saved, like
right before saving the abilityGroup:
{
["Phasewave"] = ▼ {
[1] = ▼ {
[1] = ▶ {...},
["SelectedGroup"] = 1
}
}
}
right after a :GetAsync call:
{
["Phasewave"] = ▼ {
[1] = ▼ {
[1] = ▶ {...}
}
}
}
the code i use for saving is structured this way:
function module.saveChosenAbilityGroup(player: Player, class: string, movesetIndex: number, selectedGroupIndex: number)
local success, result = pcall(function()
local playerData = PlayerClassData:GetAsync(player.UserId) or {}
local classData = playerData[class] or {}
playerData[class] = classData
local movesetData = classData[movesetIndex] or {}
movesetData.SelectedGroup = selectedGroupIndex
classData[movesetIndex] = movesetData
print(playerData)
PlayerClassData:SetAsync(player.UserId, playerData)
end)
if not success then warn(result) end
end