[SOLVED] BillboardGui not visible?

Hello,

I am making a gun that has a headshot system. I want to make the player know that they have shot the dummy’s head by making a billboard GUI and a TextLabel. Problem is, it does not work. It creates the BillboardGui and the TextLabel but it doesn’t appear?
Here’s the section of the script:

if hit.Name == "Head" and not headshotting then
			headshotting = true
			local head = hit or hit.Parent:FindFirstChild("Head")
			local newBillboardGui = Instance.new("BillboardGui",head)
			newBillboardGui.AlwaysOnTop = false
			newBillboardGui.Size = UDim2.fromScale(200,50)
			newBillboardGui.ResetOnSpawn = false
			newBillboardGui.Adornee = hit
			newBillboardGui.StudsOffsetWorldSpace = Vector3.new(0,2.5,0)
			local newTextLabel = Instance.new("TextLabel",newBillboardGui)
			newTextLabel.Text = "HEADSHOT!"
			newTextLabel.Size = UDim2.fromScale(200,50)
			newTextLabel.BackgroundTransparency = 1
			newTextLabel.TextSize = 40
			--local track = TS:Create(newTextLabel,TI,goals)
			--track:Play()
			task.wait(2)
			headshotting = false
		end

You can ask for the full script in the replies

1 Like

This could be happening because you’re making your TextLabel too big. Try setting its size to UDim2.fromScale(1, 1) so that it will fit within its parent. The size is relative to the GuiObject's parent, which, in this case, is the BillboardGui.

Ok, i ran into another problem. It’s not showing up again, and I think it’s because of this section:

local TI = TweenInfo.new(2)
local goals = {}
goals.Position = UDim2.new(math.random(0.2,1),0,0.6,0)
goals.Transparency = 1

OK. Are you tweening the BillboardGui or the TextLabel? And you do know that setting the Transparency property to 1 makes the object invisible?

The TextLabel

hef jsdhfsdjhfsd

I know that the transparency makes the object invisible. I am trying to do it over time.

OK. I do not see a problem with this code. Maybe the issue is the AnchorPoint of the TextLabel. However, you should still be able to see the transition. Is there something before or after this code?

It’s a section in a gun script; I don’t think there is anything before it or after it causing the issue.

Ok, it kinda works a bit but it didn’t delete my GUI even though I added it to Debris?

May I see that snippet of code?

Ok

if hit.Name == "Head" and not headshotting then
			headshotting = true
			local head = hit or hit.Parent:FindFirstChild("Head")
			local newBillboardGui = Instance.new("BillboardGui",head)
			BULLET_DAMAGE = BULLET_DAMAGE*2
			newBillboardGui.AlwaysOnTop = false
			newBillboardGui.Size = UDim2.fromScale(200,50)
			newBillboardGui.ResetOnSpawn = false
			newBillboardGui.Adornee = hit
			newBillboardGui.StudsOffsetWorldSpace = Vector3.new(0,2.5,0)
			local newTextLabel = Instance.new("TextLabel",newBillboardGui)
			newTextLabel.Text = "HEADSHOT!"
			newTextLabel.Size = UDim2.fromScale(1,1)
			newTextLabel.BackgroundTransparency = 1
			newTextLabel.TextSize = 40
			newTextLabel.TextColor = BrickColor.Red()
			newTextLabel.AnchorPoint = Vector2.new(0,0)
			local goals = {}
			goals.Position = UDim2.new(math.random(0.5,2),0,1,0)
			goals.Transparency = 1
			local track = TS:Create(newTextLabel,TI,goals)
			track:Play()
			game:GetService("Debris"):AddItem(newBillboardGui,3)
			task.wait(2)
			headshotting = false
		end

Hm. I am unsure of the issue. You should make another post for this so that others know to help.

Nevermind, I fixed the issue. I just removed the transparency part. Thank you for your help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.