ahaah yea I completely read over the datastore part XD Quick thing though, obviously this needs to be setup when a player joins, but also loaded when the player joins.
local dataStoreService = game:GetService('DataStoreService')
local httpService = game:GetService('HttpService')
local classDataStore = dataStoreService:GetDataStore('ClassData', 'Test')
classData = {
Classes = {
['Knight'] = {
['Weapons'] = {
'Classic Sword',
},
['Armours'] ={
'Knight Armour'
} ,
['Trails'] ={
'None'
}
},
EquippedKnight = {
Weapon = 'Classic Sword',
Armour = 'Knight Armour',
Trail = 'None'
},
['Archer'] = {
['Weapons'] = {
'Bow and Arrow'
},
['Armours'] ={
'Archer Armour'
} ,
['Trails'] ={
'None'
}
},
EquippedArcher = {
Weapon = 'Bow and Arrow',
Armour = 'Archer Armour',
Trail = 'None'
}
},
EquippedClass = 'Knight',
}
game.Players.PlayerAdded:Connect(function(player)
local setJSON = httpService:JSONEncode(classData)
classDataStore:SetAsync(player.UserId, setJSON)
local loadJSON = classDataStore:GetAsync(player.UserId)
local data = httpService:JSONDecode(loadJSON)
end)
Little unsure if it would just load up that same default table that’s setup under classData. Which raises another question. Saving it. Surely just this would work??
game.Players.PlayerRemoving:Connect(function(player)
local saveJSON = httpService:JSONEncode(classData)
classDataStore:SetAsync(player.UserId, saveJSON)
end)
But I mean looking at this, looks like it’s just gonna save the table at the top of the script, and not the actual players one, which may have been edited.