Hello guys. I’m trying to create a gang system like in YBA (roblox game I don’t know if any of you played this). The system will work like this: you will create a gang with some criteria and when you manage to do that, the script will create a new StringValue (with instance.new). The Valor name is the gang name and the New Valor value is the gang password. It’s not the problem, now I need to save the gangs that were created in the game, so when the server shuts down you can join or when you create something like your friend can join without shutting down the server on another server. I tried using the script below but it didn’t work because when trying to GetAsync on a new server it doesn’t have a value to set Async because the value doesn’t save. I really don’t know how to fix and do this, I’m not a beginner but I don’t know bro, I guess I’m dumb?
local Sucesso, Resposta = pcall(function() warn("Carregando gangues...") local DSService = game:GetService("DataStoreService") local GangStore = DSService:GetDataStore("Gangs") local Gangues = game.ReplicatedStorage:WaitForChild("Gangs") wait(1) local stats = Gangues:GetChildren() for i = 1, #stats do stats[i].Value = GangStore:GetAsync(stats[i].Name) or GangStore:SetAsync(stats[i].Name, stats[i].Value) end end) if not Sucesso then warn("As gangues do jogo não foram carregadas corretamente.") else print("As gangues do jogo foram carregadas corretamente.") end game:BindToClose(function() warn("Salvando gangues...") local Sucess2, Resposta2 = pcall(function() local DSService = game:GetService("DataStoreService") local GangStore = DSService:GetDataStore("Gangs") local Gangues = game.ReplicatedStorage:WaitForChild("Gangs") local statstorage = Gangues:GetChildren() for i = 1, #statstorage do GangStore:SetAsync(statstorage[i].Name, statstorage[i].Value) end end) if not Sucess2 then warn("As gangues do jogo não foram salvas corretamente.") else print("As gangues do jogo foram salvas corretamente.") end end) 