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

How to edit newly created text labels?

Asked by 10 years ago

I've been working on a script for a minigames game and I've hit a dead end. The old script I had used hints at the top of the screen but I'd like to turn those into GUIs for a more updated look. I've been able to change all the hints in the script by changing just one line of the script to;

h = Instance.new("TextLabel", game.StarterGui.ScreenGui.TextLabel)

...and it works perfect! It displays the hints as TextLabels. The only problem I have is that they are too small, not centered onto a frame (It's actually a pre-existing TextLabel with no words, only a opaque black frame ) I have already set and they are too dark ( I need them white ). What can I add to this that would allow me to fix these properties?

Frame's position: {0.5, -500},{0.5, -340} Frame's size: {0, 980},{0, 20}

Thank you for the help!

1 answer

Log in to vote
2
Answered by 10 years ago

My guess is that hints don't have the same properties that textlabels use. To remedy this, update the code to edit properties that textlabels actually possess. You can manipulate the textlabel's properties like so:

h = Instance.new("TextLabel", game.StarterGui.ScreenGui.TextLabel)
h.Size = UDim2.new(0, 980, 0, 20) --Make sure to use UDim2, NOT Vector3
h.Position = UDim2.new(.5, -500, .5, -340)
h.Text = "Stuff" --Make sure this is a string
h.BackgroundColor3 = Color3.new(1, 1, 1) --GUIs only accept Color3 values, which range from 0 to 1. To convert other colors to Color3, divide each number by 255. In this case, white is (255, 255, 255) and 255/255 = 1.

Use the properties window to view the textlabel properties that you can edit. I hope this helped!

0
Thanks this helped a lot but when the new labels are created they are draggable. To stop this would I add "h.Draggable = false" ? TonyBlocks 0 — 9y
0
That would be correct! And I'm glad my answer helped. If you found this answer helpful, you can accept it. IcyArticunoX 355 — 9y
Ad

Answer this question