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

Why Won't This Image Label Appear?

Hi, I made this script and everything works fine, the GUI pops up and even in output where I say "print image" it prints out a URL that leads to a picture that I want to use (In this case a user avatar) however in-game I don't get any errors but the image label won't change, here's the script and thanks in advance

wait(10)
local DIDend = game.Workspace.Dangerous_Dirt.EndPart
local Players = game:GetService("Players")
local debounce = false


DIDend.Touched:Connect(function(hit)
	if not debounce then 
		debounce = true
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	local userId = player.UserId
	print (userId)
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size352x352
	local imageLabel = game.StarterGui.PlayerWin.Frame.PlayerAV
	imageLabel.Image = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
	print(imageLabel.Image)
	imageLabel.Size = UDim2.new(0, 352, 0, 352)
		game.ReplicatedStorage.ShowGui:FireAllClients(game.Players:GetPlayerFromCharacter(hit.Parent))
			debounce = false
			DIDend:Destroy()
	end
	
end)

2 answers

✓ Accepted answer

Your code wasn't working because StarterGui only changes for players that joined the game after the change, so you need to change it for all player's that are already on the game:

wait(10)
local DIDend = game.Workspace.Dangerous_Dirt.EndPart
local Players = game:GetService("Players")
local debounce = false


DIDend.Touched:Connect(function(hit)
    if not debounce then 
        debounce = true
    local player = Players:GetPlayerFromCharacter(hit.Parent)
    local userId = player.UserId
    print (userId)
    local thumbType = Enum.ThumbnailType.HeadShot
    local thumbSize = Enum.ThumbnailSize.Size352x352
    for i,v in pairs (game.Players:GetPlayers()) do -- Indivudually changes the gui for all players
        local imageLabel = v.PlayerGui.PlayerWin.Frame.PlayerAV 
        imageLabel.Image = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
    end    
    print(imageLabel.Image)
    imageLabel.Size = UDim2.new(0, 352, 0, 352)
        game.ReplicatedStorage.ShowGui:FireAllClients(game.Players:GetPlayerFromCharacter(hit.Parent))
            debounce = false
            DIDend:Destroy()
    end

end)

1 comment

0

Thank you so much!

Make sure that the image label is not archivable If you're having trouble finding the archivable option just add a server script inside the image label

The script:

script.Parent.Archivable = false

1 comment

0

This made it disapear from startergui

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