Imagelabel named "TeamImage" not changing to visible

I’m having issues with TeamImage not changing to visible, despite my efforts in changing the script. Below you may find the associated code

Serverscript

local Settings = script.Parent.Settings
local Path = nil
local Teams = game:GetService("Teams")
local replicatedStorage = game:GetService("ReplicatedStorage")
local managementEvent = replicatedStorage.ManagementTeam

--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)

managementEvent.OnServerEvent:Connect(function(player, teststring, teamCheck)
	if teamCheck == Teams.Management then
		print(teamCheck)
		local NewSlot = script.Parent.LeaderboardFrame.HoldingFrame.Sample:Clone()
		NewSlot:WaitForChild("TeamImage").Visible = true
		NewSlot.Name = player.Name
	end
end)

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
1 Like

This is inside ScreenGUI right? Could you please show me how you have things set up in there

alright!

image
image

Try this

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
        player.PlayerGui.CustomLeaderboard.LeaderboardFrame.HoldingFrame:FindFirstChild(player.Name).TeamImage.Visible = true
	end
end)```

This would only change it for the specific player, but I’m trying to see if it does become visible if you access it through PlayerGUI.

This works! But this opens up another problem… It resets once the character resets…

https://gyazo.com/debbf7f56b3be3d1431a3bbedc9f5251

Okay the easiest way to do this is to set up another RemoteEvent called TeamImageVisible and do

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)

Then inside a local script inside the TeamImage do

local teamImageVisible = game.ReplicatedStorage.teamImageVisible
teamImageVisible.OnClientEvent:Connect(function()
     script.Parent.Visible = true
end)

for the first code snippet, do I put it within the same script that I was using, or does it have to be another script?

To stop the GUI from resetting once the character resets, if you click on the CustomLeaderboard ScreenGUI and scroll down in it’s properties you will find “ResetOnSpawn”, set that to false and the UI should remain the same when the player dies.

The first code snippet you can just use it inside the same script, just replace the managementEvent you already have with this one

it should work with multiple players if i disable the leaderboard reset on spawn, right?

It should do, but if it doesn’t, let me know and I’ll help you figure out the issue :saluting_face:

the icons don’t show up upon first joining, is there a way to rectify this?

for instance, since my sister joined me, i didn’t have an icon because i was already in the game. i only got the icon once she chose a team

I’m confused, could you elaborate?

on my screen, I had an imagelabel assigned to me thanks to the script, however, on my sister’s screen i didn’t have an icon, whilst on my screen i did. i only got the icon on her end when she joined the management team

Hmmm I’m not sure, you might have to open this thread back to find the solution

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.