I have a donation board and next to it is a statue on which the first player on the leaderboard is dancing, an overhead gui should appear saying that they are #1, their username and how many they have donated, but the gui is not appearing here is the whole script:
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local MarketplaceService = game:GetService("MarketplaceService")
local DonationsDS = DataStoreService:GetOrderedDataStore("DonationsLeaderboard")
_G.DonationsDS = DonationsDS -- make global
local DonationLB = workspace:WaitForChild("DonationLB")
local LeaderboardPart = DonationLB:WaitForChild("LeaderboardPart")
local LeaderboardGui = LeaderboardPart:WaitForChild("LeaderboardGui")
local PlayerHolder = LeaderboardGui:WaitForChild("FrameHolder"):WaitForChild("PlayerHolder")
local Statue = DonationLB:WaitForChild("GreenStatue")
local StatueCharacter = Statue:WaitForChild("Character")
local Sample = script:WaitForChild("Sample")
local RefreshTime = 60
-- Hide the sample frame
local PlayerHolderSample = PlayerHolder:FindFirstChild("Sample")
if PlayerHolderSample then
PlayerHolderSample.Visible = false
end
-- Helper: Add commas to numbers
local function commaValue(n)
local left, num, right = tostring(n):match('^([^%d]*%d)(%d*)(.-)$')
return left .. (num:reverse():gsub("(%d%d%d)", "%1,"):reverse()) .. right
end
-- Apply player appearance to a model
local function setRigAppearance(characterModel, userId)
task.spawn(function()
local success, description = pcall(function()
return Players:GetHumanoidDescriptionFromUserId(userId)
end)
if success and description and characterModel then
local humanoid = characterModel:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:ApplyDescription(description)
end
else
warn("Failed to apply description for userId " .. tostring(userId))
end
end)
end
-- Update statue overhead display
local function updateStatueOverhead(userId, donated)
local head = StatueCharacter:FindFirstChild("Head")
if not head then return end
local overheadGui = head:FindFirstChild("OverheadGui")
if not overheadGui then return end
local frame = overheadGui:FindFirstChild("Frame")
if not frame then return end
local usernameLabel = frame:FindFirstChild("UsernameLabel")
local donatedLabel = frame:FindFirstChild("DonatedLabel")
if usernameLabel then
local success, username = pcall(function()
return Players:GetNameFromUserIdAsync(userId)
end)
usernameLabel.Text = success and username or "Unknown"
end
if donatedLabel then
donatedLabel.Text = "💸 " .. commaValue(donated) .. " 💸"
end
end
-- Rainbow text effect
local function startRainbowEffect(textLabel)
spawn(function()
while true do
for i = 0, 255, 10 do wait(0.05) textLabel.TextColor3 = Color3.new(1, i/255, 0) end
for i = 255, 0, -10 do wait(0.05) textLabel.TextColor3 = Color3.new(i/255, 1, 0) end
for i = 0, 255, 10 do wait(0.05) textLabel.TextColor3 = Color3.new(0, 1, i/255) end
for i = 255, 0, -10 do wait(0.05) textLabel.TextColor3 = Color3.new(0, i/255, 1) end
for i = 0, 255, 10 do wait(0.05) textLabel.TextColor3 = Color3.new(i/255, 0, 1) end
for i = 255, 0, -10 do wait(0.05) textLabel.TextColor3 = Color3.new(1, 0, i/255) end
end
end)
end
-- Refresh leaderboard
local function refreshLeaderboard()
_G.refreshLeaderboard = refreshLeaderboard -- make global
-- Clear old frames
for _, child in ipairs(PlayerHolder:GetChildren()) do
if child:IsA("Frame") and child.Name ~= "Sample" then
child:Destroy()
end
end
-- Get top donations
local success, data = pcall(function()
return DonationsDS:GetSortedAsync(false, 10):GetCurrentPage()
end)
if not success then
warn("Failed to get leaderboard data")
return
end
for rank, entry in ipairs(data) do
local userId = tonumber(entry.key)
local donated = entry.value
local username = "Unknown"
pcall(function()
username = Players:GetNameFromUserIdAsync(userId)
end)
local displayName = username
local thumbUrl = "https://www.roblox.com/headshot-thumbnail/image?userId="..userId.."&width=48&height=48&format=png"
local newFrame = Sample:Clone()
newFrame.Name = "Player_" .. userId
newFrame.Visible = true
newFrame.Parent = PlayerHolder
local profilePic = newFrame:FindFirstChild("ProfilePicture")
local displayNameLabel = newFrame:FindFirstChild("DisplayName")
local nameLabel = newFrame:FindFirstChild("Name")
local donatedLabel = newFrame:FindFirstChild("Donated")
if profilePic and profilePic:IsA("ImageLabel") then
profilePic.Image = thumbUrl
end
if displayNameLabel and displayNameLabel:IsA("TextLabel") then
displayNameLabel.Text = displayName
end
if nameLabel and nameLabel:IsA("TextLabel") then
nameLabel.Text = "@"..username
end
if donatedLabel and donatedLabel:IsA("TextLabel") then
donatedLabel.Text = commaValue(donated)
end
-- Update statue for top donor
if rank == 1 then
setRigAppearance(StatueCharacter, userId)
updateStatueOverhead(userId, donated)
if donatedLabel then startRainbowEffect(donatedLabel) end
end
end
end
-- Main loop
while true do
refreshLeaderboard()
wait(RefreshTime)
end
here is the location of the overhead gui:
I don’t know why it isn’t showing up, if anybody knows how to fix this I would appreciate the help, thanks in advance!
