dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 01 Oct 2015 10:07 PM |
So in my script I have a line of code:
DataSaves:SetAsync("user_"..userId, PlayerData)
PlayerData is a table formatted like this:
{["Data"] = {1, (CFrame)}} -- Stores an actual CFrame instead of the word CFrame
With a string as a key to access and the table itself stores other tables. (Nested tables)
When I try saving it however, it says that "Data Contains Object that cannot be Saved." Am I not allowed to save nested tables like this?
|
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 10:21 PM |
You can't save objects via datastore. Only strings, numbers, and tables.
{["Data"] = {1, {36, 5, 36}}} |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 10:26 PM |
| I'd advise you to watch peapods tutorial.... taught me all the fundamentals of roblox's datastore, link: https://www.youtube.com/watch?v=VXcbZ2kurvk |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 01 Oct 2015 11:10 PM |
| Wait does a CFrame count as an object? If so, how can I actually save a CFrame so I can retrieve it later? |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 11:14 PM |
| {["Data"] = {1, {36, 5, 36}}} |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 01 Oct 2015 11:29 PM |
| OH! So save each element of the CFrame into a table and use a function to unload it? Thanks! |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2015 11:33 PM |
Duh ... Rude ... sandstorm ... :) |
|
|
| Report Abuse |
|
|
Ice7
|
  |
| Joined: 26 Jun 2007 |
| Total Posts: 1058 |
|
|
| 02 Oct 2015 04:02 AM |
Or, just convert the CFrame into a string and then parse it so you avoid having to set multiple keys in your datastore. Try this (it would be used for when you're retreiving the CFrame from datastore, and when you save it, just save it as tostring(SomeCFrame)):
function StringToCFrame(input) local t = {} local function nextNum(a) local s,e = string.find(a, '%d.+,') if(not e) then table.insert(t, string.sub(a, 2, string.len(a))) end if(e) then local val = string.sub(a, s,e-1) table.insert(t, val) if(string.len(a)>0) then nextNum(string.sub(a, e, string.len(a))) end end end nextNum(input) for _,v in pairs(t) do v = tonumber(v) end return CFrame.new(t[1], t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12]) end |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2015 08:36 AM |
JSONEncode(table)
i make u math.sqrt() |
|
|
| Report Abuse |
|
|