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

Why doesn't my BillboardGUI appear?

I'm loading this Script in script builder, so I don't have to use "waitforchild" or anything like that. It supposed to create a billboard gui in my head whenever i chat, but it never appears. I've tried changing values such as Enabled, Active, Visible, but those didn't work. Here is the code:

local player = game.Players['iiBallistic']
local function create_gui()
	local head= player.Character.Head
	local bill = Instance.new("BillboardGui", head)
	bill.Name = "Sans"
	local frame = Instance.new("Frame",bill)
	frame.BackgroundColor3 = Color3.new(0,0,0)
	frame.Position = UDim2.new(0,50,0,-90)
end

player.Chatted:connect(function(message)
	create_gui()
end)

help would be appreciated. Thanks.

1 answer

For first off you should use WaitForChild when using declaring local player = game.Players['28nard']. So it would be

local player = game.Players:WaitForChild('28nard') 

The reason the Gui wasn't showing up was that you never gave the Gui or Frame a Size. Size is a UDim2 value so a example is UDim2.new(1,0,1,0). So applying these to your code you get

local player = game.Players:WaitForChild('28nard') 

local function create_gui() 
	local head= player.Character.Head 
	local bill = Instance.new("BillboardGui", head)
	bill.Name = "Sans"
	bill.Size = UDim2.new(4,0,4,0)
	local frame = Instance.new("Frame",bill) 
	frame.BackgroundColor3 = Color3.new(0,0,0) 
	frame.Position = UDim2.new(0,50,0,-90)
	frame.Size = UDim2.new(1,0,1,0)
end

player.Chatted:connect(function(message) create_gui() end)

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