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

Why wont my billboard gui frame show up above my characters head?

Asked by 8 years ago

I made a billboardgui with a frame in it, the parent is the players head so it will show the players level above them, I know for a fact its not because it is inside my player and hidden because i tested that, I moved it around, it still didnt show, the background transparency is 0, and the visible bool value is set to true. Here is the code i made to create it so far if that helps at all.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        local gui = Instance.new("BillboardGui", char.Head)
        local level = player.leaderstats.Level
        local frame = Instance.new("TextLabel", gui)
        frame.Size = UDim2.new(1,0,1,0)
        frame.Position = UDim2.new(0,0,0,0)
    end)
end)

1 answer

Log in to vote
0
Answered by 8 years ago

You 1st need to wait for the characters head before adding in the gui, 2nd all you needed to do is set the GUI size.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        local gui = Instance.new("BillboardGui", char:WaitForChild('Head')) -- we need to wait for the characters head
        gui.Size = UDim2.new(0,100,0,100) -- set the gui size
        gui.StudsOffset = Vector3.new(0,2,0) -- moves the gui above the players head a bit

       local level = player.leaderstats.Level
        local frame = Instance.new("TextLabel", gui)
        frame.Size = UDim2.new(1,0,1,0)
        frame.Position = UDim2.new(0,0,0,0)
    end)
end)

Hope this helps

0
ahhh, it works, I did not notice you had to set a size for a billboard gui. Thanks AWESOMEnoob3 3 — 8y
Ad

Answer this question