Search code examples
luarobloxluau

ImageLabel doesn't display in BillboardGUI


So, this is my problem. This script works with one image id, but not any others.

I literally have no idea why this is happening. This is the script >>

function newEntity(imgId, eName)
    EntityBase = Instance.new("Part", workspace)
    EntityBase.Transparency = 1 
    EntityBase.Size = Vector3.new(0.9, 0.1, 0.7)
    EntityBase.Name = eName
    EntityBillboardGui = Instance.new("BillboardGui", EntityBase)
    EntityBillboardGui.StudsOffset = Vector3.new(0, 5, 0)
    EntityBillboardGui.Size = UDim2.new(0,250,0,250)
    EntityBillboardGui.MaxDistance = math.huge
    EntityBillboardGui.Adornee = EntityBase
    EntityImage = Instance.new("ImageLabel",EntityBillboardGui)
    EntityImage.Size = EntityBillboardGui.Size
    EntityImage.BackgroundTransparency = 1
    EntityImage.Image = imgId
    return EntityBase
end

troller = newEntity("rbxthumb://11954446780","imposter")
troller.Position = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
trololol = Instance.new("Sound", troller)
trololol.SoundId = "http://www.roblox.com/asset/?id=5677788502"
trololol:Play()
wait(2)
troller:Destroy()
game.Players.LocalPlayer.Character.Humanoid.Health = 0

Can anybody help fix it?


Solution

  • For starters I would recommend seperating the parent, like this: EntityBase = Instance.new("Part") EntityBase.Parent = workspace

    SECOND: I would recommend not using a seperate part, just put the billboardGui into the player's head

    third you used rbxthumb wrong

    rbxthumb://type=[ThumbnailType]&id=[TargetId]&w=[Width]&h=[Height]” These are the supported sizes and types

    example: rbxthumb://type=Avatar&id=123456789&w=720&h=720