How to make a Top Donators leaderboard

try printing pages, a for loop will not run if the iterator contents is nil (it might be that the datastore isn’t setting the data properly)

2 Likes

Sorry for the Bump, but do u have this as a model. It does not seem to work for me

1 Like

I can’t get on my pc right now, could you elaborate on what did the output say/did it error, and send the server script and the local script

2 Likes

Never mind, i got it to work, thank you so much. but may you please answer the following questions, if possible:

1-How to make a different color for each podium, example: 1st place = gold, 2nd = silver, 3rd = bronze, others = the normal color

2-how can i make the size of the names get smaller if they are long in order to avoid overlaying?
Because as you can see, my name is pretty long :rofl: , so my name has overlayed the robux icon.

3-How to get the Avatar (rig) of the 1st player, and how to make an animation (dancing for example)?

1 Like

In the refresh function, there’s the rank variable, which you can use to determine the color

local Color = NormalColor

if rank == 1 then Color = Color3.new(252, 255, 51) end
if rank == 2 then Color = ... end
if rank == 3 then Color = ... end

clone.BackgroundColor3 = Color

You can use TextScaled for that, although you can also make the frame longer.

You can use Players:CreateHumanoidModelFromUserId(UserId) for that

2 Likes

May you please tell me where i should put that in the script?

1 Like

you can put it inside the if statement, the top donator is the only one shown

1 Like

i do not quite understand what to do, may you please provide the full version of the code?

1 Like

Heres more information about the method

It returns the character from a given user id, then you can just do whatever you want with it

local character, lastTopUserId = nil -- keep track of the previous character to prevent memory leaks
local function refresh()
    -- ...

    for rank, data in pages:GetCurrentPage() do	
        local userId = data.key
	local amount = data.value

        if rank == 1 then
            if lastTopUserId ~= userId then
                if character then character:Destroy() end -- remove the previous donator character
                character = Players:GetHumanoidModelFromUserId(userId) -- replace with the new donator character
                character.HumanoidRootPart.Anchored = true -- prevent it from being moved
                character:PivotTo(where_you_want_it_to_be)
                character.Parent = workspace -- send it to workspace
                lastTopUserId = userId
            end
        end
        -- ... the rest
    end
end

error: GetHumanoidModelFromUserId is not a valid member of Players “Players”

in:

my mistake, it should be CreateHumanoidModelFromUserId instead of GetHumanoidModelFromUserId

1 Like

thank you so much, it worked.
i tried to make the rig dance and i got this error: LoadAnimation is not a valid member of Model “Workspace.Player”
from the last 3rd line

		if lastTopUserId ~= userId then
			if character then character:Destroy() end -- remove the previous donator character
			character = Players:CreateHumanoidModelFromUserId(userId) -- replace with the new donator character
			character.HumanoidRootPart.Anchored = true -- prevent it from being moved
			local Cframe = CFrame.new(184, 10, 23)
			character:PivotTo(Cframe)
			character.Parent = workspace -- send it to workspace
			lastTopUserId = userId
			--Animation
			local animationId = "rbxassetid://10478368365"
			local animation = Instance.new("Animation")
			animation.AnimationId = "rbxassetid://" .. animationId

			character:LoadAnimation(animation):Play()
		end
	end

Just a neat little thing I thought was important:

You don’t need a decal for the robux icon. The icons for premium and robux can be put down as text using unicode symbols.

image

Credit to this post which is where I got this from.

2 Likes

Hi, Why did u add “UiListLayout” and “UiPadding” for the donation Button
image

Sorry for asking a lot of questions

The UIListLayout serves to position the donation button and the donation frame in a “ordered list” like-layout. While the UIPadding is just there to make sure it doesn’t touch the edge of the screen

Is it possible to utilize the Position property?

I believe that using Position provides a more precise way to ensure the button’s placement is consistent across all screen sizes, without compromising its intended layout."

Yes, but theres literally no need to manually set the position, the layout is intended to be a vertical list of buttons + screen sizes dossnt affect

I believe that the screen sizes does affect the User’s experience espically on Mobile.

Please just check it yourself, It does not. Only the sizing affects it, not the UIListLayout itself

1 Like

Hey that is actually awesome as I see lots who just expect the reader to perfectly make it, as capitals, spaces, etc can all ruin the script for them

1 Like