GUI Won't Update With New Datastore

I’m trying to make it so my GUI updates every five seconds to check if the player has a new high score, or in this case has a lower time of completing the obby. I had to use two different scripts and remote events because you can’t access datastore from the client-side.

I’ve tried doing protected calls; however, I’m getting no warns within the output.

Local Script - In GUI

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local updateDataEvent = ReplicatedStorage:WaitForChild("UpdateDataEvent")

local function updateGUI(dataDictionary)
	local player = game.Players.LocalPlayer
	local gui = script.Parent
	local textLabel = gui:WaitForChild("TextLabel") 

	textLabel.Text = "" 
	local sucess, errorMessage = pcall(function()
		for key, value in pairs(dataDictionary) do
			textLabel.Text = textLabel.Text .. "Key: " .. key .. ", Value: " .. tostring(value) .. "\n"
		end
	end)
	
	if sucess then
		print("GUI updated successfully with new data")
	else
		warn("Failed to update GUI with new data: " .. errorMessage)
	end
	print("Updated GUI with new data") 
end

updateDataEvent.OnClientEvent:Connect(updateGUI)

Server Script

local dataService = game:GetService("DataStoreService")
local options = Instance.new("DataStoreOptions")
options.AllScopes = true
local DataStore = dataService:GetDataStore("SavedTimerTimes", "", options)

local dataDictionary = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local updateDataEvent = ReplicatedStorage:WaitForChild("UpdateDataEvent")

local listSuccess, pages = pcall(function()
	return DataStore:ListKeysAsync()
end)

if listSuccess then
	while true do
		local items = pages:GetCurrentPage()
		for _, v in ipairs(items) do
			local value = DataStore:GetAsync(v.KeyName)
			dataDictionary[v.KeyName] = value
		end
		if pages.IsFinished then
			break
		end
		pages:AdvanceToNextPageAsync()
	end
end

local function updateClients()
	for _, player in ipairs(game.Players:GetPlayers()) do
		local success, errorMessage = pcall(function()
			updateDataEvent:FireClient(player, dataDictionary)
		end)

		if not success then
			warn("Failed to update client", player.Name, ":", errorMessage)
		else
			print("Successfully updated client", player.Name)
		end
	end
end

while true do
	local success, errorMessage = pcall(function()
		updateClients()
		wait(5)
	end)

	if not success then
		warn("Failed to update clients:", errorMessage)
	else
		print("Successfully updated clients!")
	end
end

Any help would be great, thanks.

I have a couple of questions,

  1. Is anything else printing other than the warns?
  2. What is this “gui” for? (A leaderboard, a menu, etc.)
  3. What are you getting from the datastores, and why are you using datastores to check whether someone has gotten a highscore?
  1. Other than the success things, no.
  2. A leaderboard
  3. The datastore will store the player’s score. I’ve tested it, and it works fine, I’m just having trouble putting it on the textlabel.