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

How do you fix the errors in my script that displays a text above character's head?

local player = game.Players.LocalPlayer
local charac = player.Character

local billboardthing = Instance.new("BillboardGui")
billboardthing.Enabled = true
billboardthing.Name = "thingy"
billboardthing.Parent = player.Character.Head

aq = "Antique"

local txtkk = Instance.new("TextLabel")
txtkk.Parent = game.player.charac.Head.thingy
txtkk.Name = "label"
txtkk.Font = "Antique"
txtkk.Text = "sample text"
txtkk.BackgroundTransparency = 1
txtkk.TextSize = "30"

It ain't displaying "sample text " above my character's head.

3 comments

0

where is this script and what type of script is it?

0

A LocalScript and it's in Workspaace.

0

local scripts do not run in the workspace only under the players character model.

1 answer

Well for starters you made three simple mistakes.

  1. You set the TextLabel's parent incorrectly
txtkk.Parent = game.player.charac.Head.thingy

-- fixed version

txtkk.Parent = charac.Head.thingy
  1. You set the Font property incorrectly.
txtkk.Font = "Antique"

-- fixed version

txtkk.Font = Enum.Font.Antique

and 3. (not really a mistake, but still worth mentioning) You set the FontSize using a string value.

txtkk.TextSize = "30"

-- fixed version

txtkk.TextSize = 30

But even after these fixes, it doesn't show up, that is because you forgot to set the size of the TextLabel and the BillboardGui. (You also should've set a StudOffset to make the label show properly)

Here is a fixed version of your script.

local player = game.Players.LocalPlayer
local charac = player.Character

local billboardthing = Instance.new("BillboardGui")
billboardthing.Enabled = true
billboardthing.Name = "thingy"
billboardthing.Parent = charac.Head
billboardthing.Size = UDim2.new(0,100,0,50)
billboardthing.StudsOffset = Vector3.new(0,2,0)

aq = "Antique"

local txtkk = Instance.new("TextLabel")
txtkk.Parent = charac.Head.thingy
txtkk.Name = "label"
txtkk.Font = Enum.Font.Antique
txtkk.Text = "sample text"
txtkk.BackgroundTransparency = 1
txtkk.TextSize = 30
txtkk.Size = UDim2.new(1,0,1,0)

EDIT: Also make sure to put the script in StarterGui,StarterPack,StarterPlayerScripts,or StarterCharacterScripts

2 comments

0

The font part is incorrect. You can use string to assign fonts.

0

Oh wow, I didn't know that, good to know.

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