So i'm trying to save a table (DEFAULT_ADMINS) as a datastore whenever the function saveAdminList() is used. Here's what I have:

local dss = game:GetService("DataStoreService")
local ds = ds:GetDataStore("admins")
local function saveAdminList()
ds:SetAsync(1, DEFAULT_ADMINS)
end)

I have no idea why it doesn't work, all help is appreciated!

EDIT: It appears it may be something wrong with how i use it, here's how its used:

elseif msg:sub(1, 7):lower() == prefix.."admin " then
				local TargetString = msg:sub(8):lower()
				for _, v in ipairs(Players:GetPlayers()) do
					if v.Name:lower():sub(1, TargetString:len()) == TargetString then
						if v.Name ~= plr then
							table.insert(DEFAULT_ADMINS, v.Name)
							saveAdminList()
							print(unpack(DEFAULT_ADMINS))
						end
					end
				end

I give up, here's all the code: https://codeshare.io/G6bodN

5 comments

0

btw this is for some custom admin commands

0

that will work unless you load it incorrectly or have api services off

0

i'll check if i have api services on

0

still broken