Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a GUI pop up with player username and picture?

I would like to make a story game which makes it have their username and their profile picture when you click a part, and turns off the collisions and makes the transparency 1. Basically if they click the button it'll make them say something and it will open a GUI. Problem is, I don't know how to make it and there are no videos on it. I've tested the script and it still has not worked.

Current code:

local Players = game:GetService("Players")
local plrName = Players.LocalPlayer.Character.Name
local image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. plrName
local textButton = script.Parent.ClickDetector -- Change to directory of the textButton
local imageLabel = game.Players.LocalPlayer.PlayerGui.someonetouchedit.ImageLabel -- Change to directory of the image label

function onClicked()
	imageLabel.Image = image
	game.Players.LocalPlayer.PlayerGui.someonetouchedit.PlrName.Text = plrName
	
end

	textButton.MouseButton1Click:connect(onClicked)

Please don't judge me on my scripting, I'm kind of bad ????

1 answer

Maybe this would work.

Did not have the time to test as im currently on phone :/

local Players = game:service('Players')
local plrName = Players.LocalPlayer.Name -- character is the name of their character. you can simply get the name from the player themself
local image = Players:GetUserThumbnailAsync(Players.LocalPlayer.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
local textButton = script.Parent.ClickDetector -- Change to directory of the textButton
local imageLabel = game.Players.LocalPlayer.PlayerGui.someonetouchedit.ImageLabel -- Change to directory of the image label

function onClicked()
    imageLabel.Image = image
    game.Players.LocalPlayer.PlayerGui.someonetouchedit.PlrName.Text = plrName

end

    textButton.MouseButton1Click:connect(onClicked)

You also need to use a local script if you are going to use LocalPlayer.

2 comments

0

Sorry, this script doesn't work and doesn't show me any errors. I will try a different script if there's another answer.

0

i got it working here: https://www.roblox.com/games/6461075678/game-example-4-dgakt (you will need to edit it)

This discussion is preserved as it was. New answers, comments, and votes are closed.