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
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 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?