How to show image owner on custom leaderboard if theres a owner to other people

Im trying to show the image owner icon but its a local script so how do I show It server side its checking the id if its a image but do i need to use remotes? coz i don’t know how remotes work but i made custom leaderboard with these icons and trying to show for everyone but it only shows the player itself wich i dont want that!

local LeaderboardGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainClient")
local PlayerListScroll = LeaderboardGui.PlayerList

local Leaderboard = game:GetService("ReplicatedStorage").TextLabel

local Player = game.Players.LocalPlayer
local isFriendWork = Player.UserId
local IsFriend = Player:IsFriendsWith(isFriendWork)-- 10885655986


-- Function to update the leaderboard with the current player scores
local function updateLeaderboard()
	-- Get the list of players
	local players = game.Players:GetPlayers()
	-- Sort the list of players by their score in descending order
	-- Clear the existing player list
	local PLayerEnter = PlayerListScroll:FindFirstChild("PlayerEntry")

	-- Add each player to the leaderboard
	for i, player in ipairs(players) do
		-- Create a new leaderboard entry for the player
		local playerEntry = Leaderboard:Clone()
		--local playerEntry = Instance.new("TextLabel")
		--local badge = Instance.new("ImageLabel")
		
		playerEntry.Name = "PlayerEntry"
		--playerEntry.Size = UDim2.new(0.491, 0, 0, 31)
		--playerEntry.Position = UDim2.new(0, 0, 0, (i-1)*30)
		--playerEntry.BackgroundTransparency = 1
		--playerEntry.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
		--playerEntry.BorderSizePixel = 0
		--playerEntry.TextColor3 = Color3.fromRGB(255, 255, 255)
		--playerEntry.TextScaled = true
		--playerEntry.Font = Enum.Font.SourceSans
		playerEntry.Text = player.Name
		playerEntry.Parent = PlayerListScroll
		--if Player.UserId == game.CreatorId then
		if Player.UserId == 3371429392 then
			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.ImageColor3 = Color3.new(1, 1, 1)
		elseif Player.UserId == 1 then
			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.Image = 'rbxassetid://10885637246'
			playerEntry.ImageLabel.ImageColor3 = Color3.new(1, 1, 1)
		elseif Player.UserId == 409022436 then
			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.Image = 'rbxassetid://12626962506'
		end
	end
end


--game.Players.PlayerAdded

-- Update the leaderboard every time a player's score changes


-- Call the updateLeaderboard function to initialize the leaderboard
updateLeaderboard()

If you want a local script and normal script to be bale to communicate with eachother, you can use RemoteEvents. I’ll show you an example of how to use it.

LocalScript:

local rs = game:GetService("ReplicatedStorage") -- get replicated storage containing the remote
local event = rs:WaitForChild("event") -- get remote event named 'event'

local image = "http://www.roblox.com/asset/?id=9471105750" -- the image I will be sending

event:FireServer(image) -- fire the event and give the image as a variable

Script:

local rs = game:GetService("ReplicatedStorage") -- get replicated storage containing the remote
local event = rs:WaitForChild("event") -- get remote event named 'event'

event.OnServerEvent:Connect(function(player, image) -- fires when 'event:FireServer(image)' is called and receives image
	
	--do something with the image
	
end)

This way you can send images from the client to the server, which is what you want I believe.
If you don’t understand something feel free to ask!

1 Like

Do i put the local script inside my own Custom leaderboard local script?

Yes you can do that, but you need to be able to get the decal textures, because else you can’t send them to the server.

1 Like

Yes but how can i even locate the Playergui if that’s a serverscript for the image that was ended and to the server script?

Do you mean that you want to send the decals of other players back to the local script?

1 Like

e maybe not but to the custom leaderboard but i dont know since its a server script it cant put it in player GUI? OH WAIT I THINK I GOT IT!!11! or not

With a server script you can’t edit the player gui, so if you want 1 player to see all other decals aswell, you need to send the player’s decal to all clients so they receive it in their local script. You can do this with event.FireAllClients(image) I think.

1 Like

Here’s an example

Local:

local rs = game:GetService("ReplicatedStorage") -- get replicated storage containing the remote
local event = rs:WaitForChild("event") -- get remote event named 'event'

local image = "http://www.roblox.com/asset/?id=9471105750" -- the image I will be sending

event:FireServer(image) -- fire the event and give the image as a variable

event.OnClientEvent:Connect(function(image)
	
	-- you got the image of the joined player!
	
end)

Server:

local rs = game:GetService("ReplicatedStorage") -- get replicated storage containing the remote
local event = rs:WaitForChild("event") -- get remote event named 'event'

event.OnServerEvent:Connect(function(player, image) -- fires when 'event:FireServer(image)' is called and receives image
	
	event:FireAllClients(image)
	
end)
1 Like

Will this do only for the user who is the owner and the people who sees it that arent owner and not for them right? only for the owner the image changes and everyone sees it

		event.OnClientEvent:Connect(function(serverevent)

			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.ImageColor3 = Color3.new(1, 1, 1)
		end)

If all the players receive the event then it will change for all of them, as it is fired to their own local script

the leaderboard broke becuase the textlabel isnt showen heres the thing with the error:

 Players.danodanya12Beta21.PlayerGui.LeaderMain:22: attempt to index nil with 'Destroy'  -  Client - LeaderMain:22
local LeaderboardGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("MainClient")
local PlayerListScroll = LeaderboardGui.PlayerList

local Leaderboard = game:GetService("ReplicatedStorage").TextLabel

local Player = game.Players.LocalPlayer
local isFriendWork = Player.UserId
local IsFriend = Player:IsFriendsWith(isFriendWork)-- 10885655986

local rs = game:GetService("ReplicatedStorage") -- get replicated storage containing the remote
local event = rs:WaitForChild("ReloadCheckerOwner") -- get remote event named 'event'

local serverevent = "http://www.roblox.com/asset/?id=9471105750" -- the image I will be sending

-- fire the event and give the image as a variable
-- Function to update the leaderboard with the current player scores
local function updateLeaderboard()
	-- Get the list of players
	local players = game.Players:GetPlayers()
	-- Sort the list of players by their score in descending order
	-- Clear the existing player list
	PlayerListScroll:FindFirstChild("PlayerEntry"):Destroy()

	-- Add each player to the leaderboard
	for i, player in ipairs(players) do
		-- Create a new leaderboard entry for the player
		local playerEntry = Leaderboard:Clone()
		--local playerEntry = Instance.new("TextLabel")
		--local badge = Instance.new("ImageLabel")
		
		playerEntry.Name = "PlayerEntry"
		--playerEntry.Size = UDim2.new(0.491, 0, 0, 31)
		--playerEntry.Position = UDim2.new(0, 0, 0, (i-1)*30)
		--playerEntry.BackgroundTransparency = 1
		--playerEntry.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
		--playerEntry.BorderSizePixel = 0
		--playerEntry.TextColor3 = Color3.fromRGB(255, 255, 255)
		--playerEntry.TextScaled = true
		--playerEntry.Font = Enum.Font.SourceSans
		playerEntry.Text = player.Name
		playerEntry.Parent = PlayerListScroll
		--if Player.UserId == game.CreatorId then
		event.OnClientEvent:Connect(function(serverevent)

			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.ImageColor3 = Color3.new(1, 1, 1)
		end)
		if Player.UserId == 3371429392 or game.CreatorId then
			event:FireServer(serverevent)
		elseif Player.UserId == 1 then
			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.Image = 'rbxassetid://10885637246'
			playerEntry.ImageLabel.ImageColor3 = Color3.new(1, 1, 1)
		elseif Player.UserId == 409022436 then
			playerEntry.ImageLabel.ImageTransparency = 0
			playerEntry.ImageLabel.Image = 'rbxassetid://12626962506'
		end
	end
end





--game.Players.PlayerAdded

-- Update the leaderboard every time a player's score changes


-- Call the updateLeaderboard function to initialize the leaderboard
updateLeaderboard()

Wait fixed but whys other people with the owner image that’s not what it should be now I have another bug when the other player is first and the new player joins the other player doesn’t see the player textlabel name there but the new player sees the other player name and themself please help why is this breaking more

then you need to make the script edit it for the other player aswell

1 Like