I am using DataStore2, when using DataStore2(“Data”, Player):Get() in studio it returns the correct player data. If I run that command in game it returns the default data that I have set for the players.
If it helps here is the code I’m using to set the players data when they join.
game.Players.PlayerAdded:Connect(function(Player)
--- SET DEFAULT DATA
DS2.Combine("PlayerData", "Data")
if DS2("Data", Player):Get() == nil then
DS2("Data", Player):Set(DefaultData)
end
local OldTable = DS2("Data", Player):Get()
local Found = false
for key, value in next, OldTable.Inventory.Accessories do
if value == "None" then
Found = true
break
end
end
if not Found then
table.insert(OldTable.Inventory.Accessories, "None")
DS2("Data", Player):Set(OldTable)
end
DS2:SaveAll(Player)
print("Data for "..Player.Name.." set and saved")
end)
The problem is the data in game is always the default data, the data returned in studio is the correct data, any ideas?