I’m not sure what exactly, this means and I’ve searched the error on dev forum, but most the solutions didn’t work for me. if anyone could tell me why this error and happening and how to fix it, it would greatly help!
function PlayerTable.OnPlayerRemoving(Player)
local PlayerData = SessionData[Player.UserId]
if PlayerData then
DataStore:UpdateAsync(Player.UserId, function(OldData)
if PlayerData then
return PlayerData
elseif not PlayerData then
return nil
end
end)
end
end
You cannot save Instances in a table, instead try using a string in replacement of HousingModule.StarterHouse so you can do HousingModule:FindFirstChild(House) in some other script that loads the house.
You can’t save Dictionaries or Instances, you will need to give an ID or Key to define each house with a string value and use an array, not a dictionary.
Instead of trying to save the actual house instance, which is impossible to do with datastore as it doesn’t allow you to store instances, you should instead save the house layout in some kind of way so you can rebuild it using that data you saved.
Adding to @Aspecky 's post, you can encode all the altered properties in a JSONEncoded table and later JSONDecode it and construct a new house using the table.
JSONEncoded Tables are actually strings, so they are accepted in Roblox Datastores, but Roblox sometimes automatically converts tables to formattedData (idk whether it is JSON). However, this is kinda buggy so JSONEncoding is essentially just an extra precaution.