Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Any reasons why my leaderboard code won't work?

local complete,err = pcall(function()
	local Data = GlobalData:GetSortedAsync(false, 7)
	local Page = Data:GetCurrentPage()
	for Rank, PlrData in ipairs(Page) do
		local UserId = PlrData.key
		local Coins = PlrData.value
		local New = Clone:Clone()
		New.Coins.Text = Coins
		New.Name.Text = Players:GetPlayerByUserId(UserId).Name
		New.LayoutOrder = Rank
		New.Parent = Board.SurfaceGui.Background
	end
end)

An error has always been in the output that has the following error title:

ServerScriptService.Leaderboard:24: attempt to index field 'Name' (a string value)

2 comments

0

Im not really sure try using a while loop when changing the value of the coins.

0

I'm already doing that in another part of the script

1 answer

I just noticed myself, that I confused the script by thinking that I am trying to rename the TextLabel.

Thank you for everyone who replied though.

This discussion is preserved as it was. New answers, comments, and votes are closed.