I have a big canvas for an upcoming project, and when it’s loading it, it takes up to 15 minutes or more. I have absolutely no idea on how to fix this because I am pretty inexperienced with Data Stores. How would I speed up this? There’s around 1500 different canvas slots. They DO load but extremely slowly.
SCRIPT:
local datastore = game:GetService("DataStoreService")
local DS2 = datastore:GetGlobalDataStore("TilesNew")
--local va =datastore:GetDataStore("Tiles")
local asv = workspace.Baseplate.Canvas:getChildren()
local numb = 0
local finishedloading = false
local loadingmsg = Instance.new("Message",workspace)
loadingmsg.Text = "Loading up the Canvas, It will take up to 15 minutes."
game.Lighting.allslots.Value = #asv - 1
for i=1, #asv do
if asv[i]:IsA("ImageButton") then
--print(numb)
--table.insert(stupidpeople,asv[i])
--va:SetAsync(tostring(asv[i].Name),{1,1,1})
local continues = false
task.spawn(function()
numb = numb + 1
game.Lighting.slotsloaded.Value = numb
if numb == (#asv - 1) then
--loadingmsg:Destroy()
loadingmsg:Destroy()
finishedloading = true
game.Lighting.Loading.Value = false
local loadingmsgv = Instance.new("Message",workspace)
loadingmsgv.Text = "Done! You can now start painting!"
game.Debris:AddItem(loadingmsgv,2)
end
end)
local data
local success, response = pcall(function()
data = DS2:GetAsync(tostring(asv[i].Name))
end)
if success then
if data ~= nil then
--print(data[1])
--print(data[2])
--print(data[3])
asv[i].BackgroundColor3 = Color3.new(data[1],data[2],data[3])
asv[i].ImageColor3 = Color3.new(data[1],data[2],data[3])
continues = true
end
else
continues = true
end
--print("Slot "..asv[i].Name.." has loaded.")
end
end
--for i=1,#stupidpeople do
-- local data = va:GetAsync(tostring(stupidpeople[i].Name))
-- if data then
-- local vars = workspace.Baseplate.Canvas:FindFirstChild(stupidpeople[i].Name)
-- if vars ~= nil then
-- if data ~= nil then
-- vars.BackgroundColor3 = Color3.new(data[1],data[2],data[3])
-- end
-- end
-- end
--end