How can I save the player's position in a datastore?
I have a datastore system in my game that will save various player data like their money, health, their inventory, position, ect. I store each in a table in the datastore. I'm new to datastores, so I don't understand it entirely, but when I create another variable in the table for the position (which I don't actually use position, I use the humanoidrootpart's CFrame), it gives me the error:
104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters.
I've tried this with both .Position and .CFrame, but I get the same error. Is there a workaround for this?
Here's the part of my script giving me trouble:
01 | local dataID = plr.UserId |
04 | local playerStatus = { } |
07 | for i,v in pairs (plr.Character.Equipped:GetChildren()) do |
08 | equipCount = equipCount + 1 |
09 | table.insert(equipped,equipCount,v.RealName.Value) |
11 | for i,v in pairs (plr.Inventory:GetChildren()) do |
12 | storedCount = storedCount + 1 |
13 | table.insert(stored,storedCount,v.RealName.Value) |
16 | Pounds = plr.Status.Pounds.Value, |
19 | Health = plr.Status.Health.Value, |
20 | Position = plr.Character.HumanoidRootPart.CFrame, |
22 | local success, errormessage = pcall ( function () |
23 | playerData:SetAsync(dataID, data) |