How to get player’s name and profile headshot that shows to others?

I am making ID item that shows your username and profile picture to others. I already made scripts (below) for them, but name and profile picture works only for player that has them.

Name script:

local Players = game:GetService("Players").LocalPlayer
local PlayerName = Players.Name
local TextLabel = script.Parent

TextLabel.Text = PlayerName

Profile picture script

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size60x60
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

local imageLabel = script.Parent
imageLabel.Image = content
imageLabel.Size = UDim2.new(0, 70, 0, 70)

Please don’t duplicate topics. Instead, bump the older one.

2 Likes

Ok sorry, my bad.

dsdsdsdsdsdsdsds

You’re doing it in a local script (doesn’t replicated to other clients). You need to have the server do these changes for it to show.

Script inside ServerScriptService:

game.Players.PlayerAdded:Connect(function (player)
	player.CharacterAdded:Connect(function (char)
		local playerName = player.Name
		local userId = player.UserId
		local playerGui = player.PlayerGui
		local thumbType, thumbSize = Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size60x60
		local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

		local Gui = playerGui:WaitForChild("NAME OF GUI")
		Gui.TextLabel.Text = playerName
		Gui.imageLabel.Image = content
		Gui.imageLabel.Size = UDim2.new(0, 70, 0, 70)
	end)
end)
1 Like

Thank you, it is working now.

dfsfsdfsd

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