Leaderboard script not working

why does this script not work:

local setting = require(game:GetService("ServerScriptService"):WaitForChild("leaderstats"):WaitForChild("helper"))

local dss

local s, e = pcall(function()
	dss = game:GetService("DataStoreService"):GetOrderedDataStore(setting.dataName)
end)
if not s then print(e) end

local REF_TIME = 1
local key = (setting.localDataKey):format("")
print(key)

local board = script.Parent

local function update()
	print("Updating")
	local data = dss:GetSortedAsync(false, 1, 1)
	local r = data:GetCurrentPage()
	for i, v in pairs(r) do
		local uid = tonumber(data.key)
		print(uid)
		local uName = game:GetService("Players"):GetNameFromUserIdAsync(uid)
		print(uName)
		local val = v.value
		local gui = board:WaitForChild("SurfaceGui")
		gui.Names[("Name%s"):format(i)].Text = uName
		gui.Score[("Score%s"):format(i)].Text = val
	end
	print("Completed Updating")
end

local success, err = pcall(update)
if not success then warn(err) end

spawn(function()
	while task.wait(REF_TIME*60) do
		local success, err = pcall(update)
		if not success then warn(err) end
	end
end)

there are no error messages for some reason