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

Why Won't This Image Label Appear?

Asked by 4 years ago

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

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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)
0
Thank you so much! PastorCL3Z 75 — 4y
Ad
Log in to vote
-1
Answered by 4 years ago

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
0
This made it disapear from startergui PastorCL3Z 75 — 4y

Answer this question