im trying to save decals in data store, but for some reason it doesnt save, nor load. There are no errors in the output.
saving:
local datastore = game:GetService("DataStoreService")
local wrap = datastore:GetDataStore("wrap1")
local wrapcolor = datastore:GetDataStore("wrapcolor1")
local rims = datastore:GetDataStore("rims1")
local roofscoop = datastore:GetDataStore("roofscoop1")
local sides = datastore:GetDataStore("sides1")
local spoiler = datastore:GetDataStore("spoiler1")
local rcamber = datastore:GetDataStore("rcamber1")
local roffset = datastore:GetDataStore("roffset1")
local fcamber = datastore:GetDataStore("fcamber1")
local foffset = datastore:GetDataStore("foffset1")
local decalsave1 = datastore:GetDataStore("decalsave1")
local decalsave12 = datastore:GetDataStore("decalsave12")
script.Parent.OnServerEvent:Connect(function(player)
local table = {}
game.Lighting[player.Name.."Cars"].Car1:ClearAllChildren()
local e = game.Lighting[player.Name.."Cars"].CurrentCarName[game.Lighting[player.Name.."Cars"].CurrentCarName.Value]:Clone()
e.Parent = game.Lighting[player.Name.."Cars"].Car1
for i, v in pairs(e.Body:GetDescendants()) do
if v:IsA("Decal") then
table.insert(table, {
["Texture"] = obj.Texture;
["ParentName"] = obj.Parent.Name;
})
print("saving")
end
end
decalsave1:SetAsync("key", table)
end)
loading:
local datastore = game:GetService("DataStoreService")
local exhaust1 = datastore:GetDataStore("exhaust1")
local fbumper1 = datastore:GetDataStore("fbumper1")
local hood1 = datastore:GetDataStore("hood1")
local rbumper1 = datastore:GetDataStore("rbumper1")
local rims1 = datastore:GetDataStore("rims1")
local roofscoop1 = datastore:GetDataStore("roofscoop1")
local sides1 = datastore:GetDataStore("sides1")
local spoiler1 = datastore:GetDataStore("spoiler1")
local bodycolor1 = datastore:GetDataStore("bodycolor1")
local interiorcolor11 = datastore:GetDataStore("interiorcolor11")
local interiorcolor21 = datastore:GetDataStore("interiorcolor21")
local rimcolor1 = datastore:GetDataStore("rimcolor1")
local tonecolor1 = datastore:GetDataStore("tonecolor1")
local windowtint1 = datastore:GetDataStore("windowtint1")
local backleftbumper1 = datastore:GetDataStore("backleftbumper1")
local backleftfender1 = datastore:GetDataStore("backleftfender1")
local backrightbumper1 = datastore:GetDataStore("backrightbumper1")
local backrightfender1 = datastore:GetDataStore("backrightfender1")
local frontleftbumper1 = datastore:GetDataStore("frontleftbumper1")
local frontleftfender1 = datastore:GetDataStore("frontleftfender1")
local frontrightbumper1 = datastore:GetDataStore("frontrightbumper1")
local frontrightfender1 = datastore:GetDataStore("frontrightfender1")
local frontvisor1 = datastore:GetDataStore("frontvisor1")
local decalhood1 = datastore:GetDataStore("decalhood1")
local leftdoor1 = datastore:GetDataStore("leftdoor1")
local rearvisor1 = datastore:GetDataStore("rearvisor1")
local rightdoor1 = datastore:GetDataStore("rightdoor1")
local top1 = datastore:GetDataStore("top1")
local wrap1 = datastore:GetDataStore("wrap1")
local wrapcolor1 = datastore:GetDataStore("wrapcolor1")
local brakes1 = datastore:GetDataStore("brakes1")
local grip1 = datastore:GetDataStore("grip1")
local power1 = datastore:GetDataStore("power1")
local transmission1 = datastore:GetDataStore("transmission1")
local rcamber = datastore:GetDataStore("rcamber1")
local roffset = datastore:GetDataStore("roffset1")
local fcamber = datastore:GetDataStore("fcamber1")
local foffset = datastore:GetDataStore("foffset1")
local decalsave1 = datastore:GetDataStore("decalsave1")
local decalsave12 = datastore:GetDataStore("decalsave12")
local Car1 = datastore:GetDataStore("Car1")
local player = script.Parent.player.Value
wait(0.1)
script.Parent.Parent:WaitForChild(player.Name.."Data").Slot1.Car.Value = Car1:GetAsync(player.UserId) or "Empty"
local e = game.Lighting.Cars[script.Parent.Parent:WaitForChild(player.Name.."Data").Slot1.Car.Value]:Clone()
local tab = decalsave1:GetAsync("key") or {}
if tab then
for i, v in pairs(tab) do
local car= e
local decal = Instance.new("Decal")
decal.Parent = car.Body[obj.ParentName]
print("loaded")
end
end
e.Parent = game.Lighting[player.Name.."Cars"].Car1
thx ok

3 comments
Is there a way to fix this? And decalsave12 wasnt supposed to be here
well if you want to save each datastore separately, you'd need to copy the getasync function and setasync functions and edit the text for every datastore you have, otherwise, make an array, since as I said above, its cleaner.
thanks for that tip, but i meant is there a way to fix that it wont save/load?