Help to fix daily chest

Are you still having errors?

local CoinsLeaderboard = DataSoreService:GetOrderedDataStore(“CoinsLeaderboard”)

local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = data.value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.Text == Name then
isOnLeaderboard = true
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
end)
if not success then
print(errorMessage)
end
end

while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end

for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end

Is this the same script i edited above?

1 Like

yes this is the script that you wrote they are with errors

Touched is not a valid member of PlayerGui “Players.Lamino961.PlayerGui” - Server - GUI Giver:33

it also gives me this error when I approach the chest

Could you copy and paste the whole script and send it?


local function updateLeaderboard()
	local success, errorMessage = pcall(function()
		local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
		local CoinsPage = Data:GetCurrentPage()
		for Rank, data in ipairs(CoinsPage) do
			local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local Name = userName
			local Coins = data.value
			local isOnLeaderboard = false
			for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
				if v.Player.Text == Name then
					isOnLeaderboard = true
					break
				end
			end
			if Coins and isOnLeaderboard == false then
				local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
				newLbFrame.Player.Text = Name
				newLbFrame.Coins.Text = Coins
				newLbFrame.Rank.Text = "#"…Rank
				newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
				newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
			end

		end
	if not success then
		print(errorMessage)
	end
end

while true do
	for _, player in pairs(game.Players:GetPlayers()) do
		CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
	end

	for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
		frame:Destroy()
	end
	updateLeaderboard()
		wait(10)
	end
end

local errorMessage = “There is an Error”

local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = data.value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.Text == Name then
isOnLeaderboard = true
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end

  end

if not success then
print(errorMessage)
end
end

while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end

for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(10)
end
end

ServerScriptService.LeaderboardHandler:22: Expected identifier when parsing expression, got Unicode character U+2026 (did you mean ‘…’?) - Studio - LeaderboardHandler:22

local errorMessage = “There is an Error”

local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 10)
local CoinsPage = Data:GetCurrentPage()
for Rank, data in ipairs(CoinsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Coins = data.value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.Text == Name then
isOnLeaderboard = true
break
end
end
if Coins and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild(“LeaderboardFrame”):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Coins.Text = Coins
newLbFrame.Rank.Text = “#”…Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.10 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end

  end
if not success then
  print(errorMessage)
end

end

while true do
for _, player in pairs(game.Players:GetPlayers()) do
CoinsLeaderboard:SetAsync(player.UserId, player.stats.Coins.Value)
end

for _, frame in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
  frame:Destroy()
end
updateLeaderboard()
  wait(10)
end

end

I’m not too sure how to fix it. I’ll try again in a couple hours.

touched is not a valid member of PlayerGui “Players.Lamino961.PlayerGui” - Server - GUI Giver:33

it also gives me this error when I approach the chest

okay, help me fix it, I go to the chest, it gives an error