Hi everyone!
I hope you are well!
For some reason, my leaderboard is not functioning as intended. I’m not sure why. The LeaderboardHandler
was scripted by my friend since he offered to. Though, momentarily, we’re not in contact as of now.
I’ve tried to fix it myself, to no avail. Here’s the problem:
(I have showcased and explained briefly the issue in the video. I hope it was clear!)
Here’s the script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Color_Module = require(game:GetService("ReplicatedFirst").Modules.Colour)
local MainWindow = script.Parent
local Holder = MainWindow.Assets.Holder
local Leaderboard = Holder.Leaderboard
local GlobalUISpring = require(game:GetService("ReplicatedFirst").Modules.EzUISpring.GlobalPreset)
GlobalUISpring.ApplyGlobal(MainWindow.Assets)
-- Tween Stuff
local tweenInfo = TweenInfo.new(
0.3,
Enum.EasingStyle.Quint,
Enum.EasingDirection.InOut
)
-- Colorize General
Color_Module.StrokeColor(Leaderboard.UIStroke)
Color_Module.StrokeColor(Holder.Avatar.UIStroke)
Color_Module.StrokeColor(Holder.Users.UIStroke)
--Colorize LocalFrame
Color_Module.TextColor(Leaderboard.LocalFrame.Time.Time)
Color_Module.TextColor(Leaderboard.LocalFrame.FirstJoin.Value)
Color_Module.TextColor(Leaderboard.LocalFrame.GroupRole.Value)
Color_Module.TextColor(Leaderboard.LocalFrame.Username.Username)
Leaderboard.LocalFrame.Money.Cash.TextColor3 = Color3.fromRGB(126, 255, 137)
--Colorize TemplateDetails
Color_Module.TextColor(Leaderboard.TemplateDetails.Time.Time)
Color_Module.TextColor(Leaderboard.TemplateDetails.FirstJoin.Value)
Color_Module.TextColor(Leaderboard.TemplateDetails.GroupRole.Value)
Color_Module.TextColor(Leaderboard.TemplateDetails.Username.Username)
Leaderboard.LocalFrame.Money.Cash.TextColor3 = Color3.fromRGB(126, 255, 137)
--Colorize AvatarWindow
local Background = Holder.Avatar.ViewportFrame.WorldModel.View
local Red = Color_Module.Red()
local Green = Color_Module.Green()
local Blue = Color_Module.Blue()
Background.three.Color = Color3.fromRGB(Red - 10, Green -10, Blue - 10)
Background.four.Color = Color3.fromRGB(Red - 20, Green - 20, Blue - 20)
Background.one.Color = Color3.fromRGB(Red - 40, Green - 40, Blue - 40)
Background.two.Color = Color3.fromRGB(Red - 60, Green - 60, Blue - 60)
Background.base.Color = Color3.fromRGB(Red - 100, Green - 100, Blue - 100)
Color_Module.BackgroundColor(Background.Parent.Parent.Parent)
for i,pv in pairs(game.Players:GetPlayers()) do
--Create entry
local newEntry = Holder.Users.Main.Template:Clone()
newEntry.Parent = Holder.Users.Main
newEntry.Name = pv.Name
spawn(function()
newEntry.Image = game.Players:GetUserThumbnailAsync(pv.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end)
newEntry.Visible = true
-- Make new frame for entry and Connect click event
local success, response = pcall(function()
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("MakePlayerSS", pv)
end)
if success then
-- Ask the server for other player data
spawn(function()
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchJoin", pv)
while task.wait(5) do
if pv == nil then break end
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchCash", pv)
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchTime", pv)
end
end)
Leaderboard:WaitForChild(pv.Name).Username.DisplayName.Text = game.Players:FindFirstChild(pv.Name).DisplayName
Leaderboard:WaitForChild(pv.Name).Username.Username.Text = game.Players:FindFirstChild(pv.Name).Name
newEntry.MouseButton1Down:Connect(function()
for i,v in pairs(Leaderboard:GetChildren()) do
if v:IsA("UICorner") == false or v:IsA("UIStroke") == false or v.Name ~= "TemplateDetails" then
if newEntry.Name == game.Players.LocalPlayer.Name then
for i,vB in pairs(Leaderboard:GetChildren()) do
if vB:IsA("UICorner") == false and vB:IsA("UIStroke") == false then
vB.Visible = false
end
end
Leaderboard.LocalFrame.Visible = true
else
for i,vC in pairs(Leaderboard:GetChildren()) do
if vC:IsA("UICorner") == false and vC:IsA("UIStroke") == false then
vC.Visible = false
end
end
Leaderboard:FindFirstChild(pv.Name).Visible = true
end
end
end
end)
--ID VALID CODE GOES HERE
end
end
game.Players.ChildAdded:connect(function(newplayer)
if (newplayer:IsA("Player")) then
--Create entry
local newEntry = Holder.Users.Main.Template:Clone()
newEntry.Parent = Holder.Users.Main
newEntry.Name = newplayer.Name
spawn(function()
newEntry.Image = game.Players:GetUserThumbnailAsync(newplayer.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end)
newEntry.Visible = true
-- Make new frame for entry and Connect click event
local success, response = pcall(function()
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("MakePlayerSS", newplayer)
end)
if success then
-- Ask the server for other player data
spawn(function()
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchJoin", newplayer)
while task.wait(5) do
if newplayer == nil then break end
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchCash", newplayer)
ReplicatedStorage.RemoteEvents.Leaderboard:FireServer("FetchTime", newplayer)
end
end)
script.Parent.Assets.Leaderboard:WaitForChild(newplayer.Name).Username.DisplayName.Text = game.Players:FindFirstChild(newplayer.Name).DisplayName
script.Parent.Assets.Leaderboard:WaitForChild(newplayer.Name).Username.Username.Text = game.Players:FindFirstChild(newplayer.Name).Name
newEntry.MouseButton1Down:Connect(function()
for i,v in pairs(Leaderboard:GetChildren()) do
if v:IsA("UICorner") == false or v:IsA("UIStroke") == false or v.Name ~= "TemplateDetails" then
for i,vC in pairs(Leaderboard:GetChildren()) do
if vC:IsA("UICorner") == false and vC:IsA("UIStroke") == false then
vC.Visible = false
end
end
Leaderboard:FindFirstChild(newplayer.Name).Visible = true
end
end
end)
-- ID VALID CODE GOES HERE
end
end
end)
--game.Players.ChildRemoved:connect(function(newplayer)
-- if (newplayer:IsA("Player")) then
-- To be removed from server
--Holder.Users.Main:FindFirstChild(newplayer.Name):Destroy()
-- end
--end)
I’m not sure what to do about it. What could be the issue? Any help or criticism is appreciated!