I have a custom leaderboard script, however, I am struggling to find out a way to rectify this issue. I have tried to disable and reenable the leaderboard upon a new player’s join, and this did not fix the problem. I also wish to maintain the icon functionality of this custom leaderboard, as this is the main reason why I’m looking to create a custom leaderboard…
localscript
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
local plr = game.Players.LocalPlayer
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local ManagementEvent = replicatedStorage.ManagementTeam
local teamCheck = plr.Team
plr:GetPropertyChangedSignal("Team"):Connect(function()
if plr.Team == Teams.Management then
teamCheck = Teams.Management
ManagementEvent:FireServer("test", teamCheck)
end
end)
Serverscript
--Custom Leaderboard Script. Made by Leaderboard+ plugin (by Infinite_Visions).
--Find the plugin Documentation here: https://devforum.roblox.com/t/leaderboard-create-custom-leaderboards-in-studio/1338477
local Settings = script.Parent.Settings
local Path = nil
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local managementEvent = replicatedStorage.ManagementTeam
local refreshEvent = replicatedStorage.RefreshEvent
--Handle Admins. If You Have no admins, ignore this.
local Admins = {
"Infinite_Visions",
"Example_Name_Here"
}
--Get Creator Id
local ownerId = nil
if game.CreatorType == Enum.CreatorType.Group then
local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId)
ownerId = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Id
else
ownerId = game.CreatorId
end
--Setup Players Already In-Game
for i, player in pairs(game.Players:GetChildren()) do
--Add a slot to the leaderboard
local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
NewSlot.Name = player.Name
--Handle Names
local NameText = nil
if Settings.DisplayNames.Value == true then
NameText = player.DisplayName
else
NameText = player.Name
end
if Settings.UpperCase.Value == true then
NewSlot.PlrName.Text = string.upper(NameText)
else
NewSlot.PlrName.Text = NameText
end
--Handle Icons
if player.UserId == ownerId and Settings.ShowOwner.Value == true then
NewSlot.Owner.Visible = true
else
if Settings.ShowAdmin.Value == true then
for i = 1, #Admins do
if player.Name == Admins[i] then
NewSlot.Admin.Visible = true
end
end
elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then
NewSlot.GamepassSymbol.Visible = true
elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
NewSlot.Premium.Visible = true
end
end
--If CustomData, Handle DataChanges
if Settings.CustomData.Value == true then
Path = script.Parent.Settings.CustomData
Path.Changed:Connect(function()
NewSlot.Currency1.Text = Path.Value
end)
end
NewSlot.Visible = true
--The Path to the Values you want displayed, if any.
NewSlot.Parent = script.Parent.LeaderboardFrame.HoldingFrame
end
game.Players.PlayerAdded:Connect(function(player)
--Add a slot to the leaderboard
local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
NewSlot.Name = player.Name
--Handle Names
local NameText = nil
if Settings.DisplayNames.Value == true then
NameText = player.DisplayName
else
NameText = player.Name
end
if Settings.UpperCase.Value == true then
NewSlot.PlrName.Text = string.upper(NameText)
else
NewSlot.PlrName.Text = NameText
end
--Handle Icons
if player.UserId == ownerId and Settings.ShowOwner.Value == true then
NewSlot.Owner.Visible = true
else
if Settings.ShowAdmin.Value == true then
for i = 1, #Admins do
if player.Name == Admins[i] then
NewSlot.Admin.Visible = true
end
end
elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,13376596) and Settings.CustomGamepass.Value == true then
NewSlot.GamepassSymbol.Visible = true
elseif player.MembershipType == Enum.MembershipType.Premium and Settings.ShowPremium.Value == true then
NewSlot.Premium.Visible = true
end
end
--If CustomData, Handle DataChanges
if Settings.CustomData.Value == true then
Path = script.Parent.Settings.CustomData
Path.Changed:Connect(function()
NewSlot.Currency1.Text = Path.Value
end)
end
NewSlot.Visible = true
local function test(arg1, arg2)
print("testing", arg1, arg2)
end
end)
local teamImageVisible = game.ReplicatedStorage.TeamImageVisible
managementEvent.OnServerEvent:Connect(function(player, teststring, teamCheck)
if teamCheck == Teams.Management then
print(teamCheck)
local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
NewSlot.Name = player.Name
teamImageVisible:FireAllClients()
end
end)