BillBoardGui not Showing

Basically I’m trying to add so that whenever a player joins my game they have a billboard showing how many wins they have, however my code seems fine, but no gui is appearing. I’m horrible with gui so I can’t really figure out what the problem is anyone know what it is?

Code:

1 Like

Idk, try checking these other posts.

1 Like

Both of these are for certain scenarios and not useful to me

1 Like

Your code seems fine to me. Maybe the text label isnt showing because its either too big or too small

Try adding this line of code:

TextBox.Size = UDim2.new(1, 0, 1, 0)

1 Like

Try checking up billboardgui’s property

1 Like

@SoildFork is on the right track. The size of both the BillboardGui and TextLabel are initialized to zero.

You might find it beneficial to design the GUI ahead of time, then clone it into characters.

2 Likes

Already did this. Still not working when I find a soulution I’ll let you know

local Players = game:GetService("Players")

--Function to set up the BillboardGui for a player
local function setupBillboard(player)
    local char = player.Character or player.CharacterAdded:Wait()
    local head = char:WaitForChild("Head")  -- Ensure the head exists
    
    --Create the BillboardGui
    local winsBillboard = Instance.new("BillboardGui")
    winsBillboard.Name = "WinsBillboard"
    winsBillboard.Size = UDim2.new(0, 200, 0, 50)  --Adjust size as needed
    winsBillboard.Adornee = head  -- Attach to the player's head
    winsBillboard.Parent = char  --Parent it to the character

    --Create the TextLabel
    local textBox = Instance.new("TextLabel")
    textBox.Name = "TextBox"
    textBox.Size = UDim2.new(1, 0, 1, 0)  -- Fill the BillboardGui
    textBox.BackgroundTransparency = 1  -- Make background transparent
    textBox.TextScaled = true  --Scale text to fit
    textBox.Text = player.leaderstats.Wins.Value .. " Wins"  --Set initial text
    textBox.Parent = winsBillboard  --Parent the TextLabel to the BillboardGui

    --Create the UICorner (optional, for rounded corners)
    local curve = Instance.new("UICorner")
    curve.Parent = textBox

    --Update the text when the Wins value changes
    player.leaderstats.Wins.Changed:Connect(function(newWins)
        textBox.Text = newWins .. " Wins"
    end)
end

-- Connect the setup function to PlayerAdded and  events
Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        -- Wait for leaderstats to be set up
        player:WaitForChild("leaderstats")
        player.leaderstats:WaitForChild("Wins")
        
        --Set up the BillboardGui
        setupBillboard(player)
    end)
end)