generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Data Store Help

Previous Thread :: Next Thread 
dansk is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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
NormaINorm is not online. NormaINorm
Joined: 11 Dec 2012
Total Posts: 315
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 is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
01 Oct 2015 11:14 PM
{["Data"] = {1, {36, 5, 36}}}
Report Abuse
dansk is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
01 Oct 2015 11:33 PM
Duh
... Rude ... sandstorm ... :)
Report Abuse
Ice7 is not online. 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
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
02 Oct 2015 08:36 AM
JSONEncode(table)


i make u math.sqrt()
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image