Unless they have changed down DataStores work in the last year, it is impossible to save a DataStore as far as I know. For example, doing something such as DataStore:SetAsync(Player.UserId,{UD,BD,PD})
Will just return an error, saying that this is an invalid type. Is there something that I am missing, or is it impossible to natively store a table in roblox? I've tried external methods, such as with trellos, however recent changes to how they work leaves this method with an insufficient bandwidth. Any hints or help with this would be very helpful.
Edit: Before anyone mentions strings/JSONs, yes, I am aware of this, however it also prevents me from saving strings.
It is very possible to save DataStores, especially with tables. If there wasn't 80% of the games on Roblox right now would be broken. The method you showed above is correct...
DataStore:SetAsync(Player.UserId,{UD,BD,PD})
However, it depends on what UD, BD, and PD are. You can only save more primitive values such as Strings, Numbers, or Tables to name a few. It doesn't work for Instances such as parts or ValueObjects, and it won't save CFrames or Vector3s. For example...
local UD = 5 local BD = 10 local PD = 1 DataStore:SetAsync(Player.UserId,{UD,BD,PD}) -- Works
--
local UD = CFrame.new(0,0,0) local BD = CFrame.new(0,5,0) local PD = CFrame.new(5,0,0) DataStore:SetAsync(Player.UserId,{UD,BD,PD}) -- Doesn't work
--
local UD = workspace.Baseplate local BD = workspace.Player local PD = workspace.Ball DataStore:SetAsync(Player.UserId,{UD,BD,PD}) -- Doesn't work
You can make your tables more advanced too...
local saveEntry = { UD = 1, BD = 2, PD = 3, } DataStore:SetAsync(Player.UserId, saveEntry) -- Works local data = DataStore:GetAsync(Player.UserId) print(data.UD, data.BD, data.PD)
Note: In order to do any Datastore work in studio, make sure the Permission is enabled to let the place use API in studio.