Hi, I'm making a game where you attack other players' bases. Kind of like in Clash Of Clans. The problem is that my script for loading the bases is somehow too slow. Here is the "main part" of the script
local dsb = game:GetService("DataStoreService"):GetDataStore("Buildingsalpha")
local folder = Instance.new("Folder")
folder.Parent = workspace
folder.Name = "buildings"
for i = 1, #workspace.BuildingRaster:GetChildren() do
local raster = workspace.BuildingRaster
local buildings = dsb:GetAsync(players[player])
if buildings[i] ~= "LEER" then
local gebaude = game.Lighting[buildings[i]]:Clone()
gebaude.Parent = workspace.buildings
gebaude:MoveTo(raster[i].Position)
end
end
"players [player]" is the id of the random base player. It is probably running slowly because of the datastore instead of everything running immediately. Is it possible to save datastore information in variables or something so that the script does not always have to query the datastore? The datastore info is a table, for information only. I look forward to answering.

1 comment
I wanted to say that I actually speak German and that's why there are a few German terms in the code