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

How do I use the player's character for a GUI?

Hi. I have been making an among us type game. I have been trying to make an emergency button. It supposed to use a picture of the player's character. (It does not work) This is the CODE:

script.Parent.Emergency.OnServerEvent:Connect(function(player)
	local Players = game:GetService("Players")
		
	print(player.UserId)
	local userId = player.UserId
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size420x420
	local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)

	-- Set the ImageLabel's content to the user thumbnail
	local imageLabel = game.StarterGui.Emergency.Frame.ImageLabel
	imageLabel.Image = content
	imageLabel.Size = UDim2.new(0, 250, 0, 250)
	
	game.StarterGui.Emergency.Frame.Visible = true
	wait(2)
	game.StarterGui.Emergency.Frame.Visible = false
		
end)

Please help :). Thanks

1 comment

0

You're doing this on the server. I recommend manipulating GUIs on the client. Also use Player.PlayerGui not game.StaterGui.

1 answer

did you forgot to put

local player = Players.LocalPlayer

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