Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
dgakt 0
3 years ago

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

Log in to vote
0
Answered by 3 years ago

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.

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. dgakt 0 — 3y
0
i got it working here: https://www.roblox.com/games/6461075678/game-example-4-dgakt (you will need to edit it) Harry_TheKing1 325 — 3y
Ad

Answer this question