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

How do I format GUI text size, color, and other things?

Asked by 10 years ago

Once again, sorry for my recently gained naive-ishness. However, if I am scripting a gui text box and want to make the text a certain size, how would I do that?

text.FontSize = 24

doesn't work. Also, do I need to program text color like this:

text.TextColor3 = Clolor3.new(242,251,255)

or is it different now? Note- 'text' is the name of the textbox, I have that settled. For extra info, here is the full program that I inserted into an exclamation mark-

local exclm = script.Parent
activated = false

function onPressed(hit)
    check = hit.Parent:findFirstChild("Humanoid")
    if check ~= nil then
        if activated == false then
            activated = true
            local Q1 = Instance.new("ScreenGui")
            Q1.Parent = game.StarterGui
            local text = Instance.new("TextBox")
            text.Parent = Q1
            text.BackgroundTransparency = 1
            text.MultiLine = true
            text.Position = UDim2.new( 0, 200, 0, 200)
            text.Size = UDim2.new( 0, 200, 0, 200)
            text.Draggable = true
            text.FontSize = 24
            text.Text = "Welcome to my nightmare. You are now reading the Journal in which I record my findings."
            text.TextScaled = true
            text.TextStrokeColor3 = 134,0,6
            text.TextColor3 = 242,251,255
            text.TextWrapped = true
            wait(6)
            text.Text = "Journals like this will guide you through my nightmare."
            wait(4)
            text.Text = "This journal has valued content; the price of reading it..."
            wait(4.5)
            text.Text = "...Is to help me defeat the demon king."
            wait(3)
            text.Text = "You will travel through many worlds and stages, fighting many demons."
            wait(4.5)
            text.Text = "Be warned, this is a cruel nightmare. If you die,  you lose everything but your expirience."
            wait(6.2)
            text.Text = "If you wake up, you may even forget what you've learned about the demons, as well as the death penalty."
            wait(7)
            text.Text = "A teleporter  will appear on one of the hills behind you when you finish reading this."
            wait(5.5)
            text.Text = "Agh! I would write more, but a banshee has found me... Help m-...!"
            wait(4)
            text.Text = "*Scratches and spilled ink are on the paper*"
            wait(4)
            text.Text = "Go, now. I need your help. GO!"
            wait(2)
            text.Text = " "

            activated = false
        end
    end
end

exclm.Touched:connect(onPressed)


0
Fix the way you arranged it first, its hard to read. To make it easier, select all your code, then click the Code Block button. Tempestatem 884 — 10y
0
done. sorry! idkmanguy 30 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago

Well, for changing the color of the text you have to divide each by 255

text.TextColor3 = Color3.new(242/255,251/255,255/255)

Text size, I think put it in a string

text.FontSize = "Size24"

I think the rest of the script looks fine. But, would it be easier to clone the GUI directly to the player rather than making a whole new GUI?

So edited, your final script should look like

local exclm = script.Parent
activated = false

function onPressed(hit)
    check = hit.Parent:findFirstChild("Humanoid")
    if check ~= nil then
        if activated == false then
            activated = true
            local Q1 = Instance.new("ScreenGui")
            Q1.Parent = game.StarterGui
            local text = Instance.new("TextBox")
            text.Parent = Q1
            text.BackgroundTransparency = 1
            text.MultiLine = true
            text.Position = UDim2.new( 0, 200, 0, 200)
            text.Size = UDim2.new( 0, 200, 0, 200)
            text.Draggable = true
            text.FontSize = "Size24"
            text.Text = "Welcome to my nightmare. You are now reading the Journal in which I record my findings."
            text.TextScaled = true
            text.TextStrokeColor3 = Color3.new(134/255,0/255,6/255)
          text.TextColor3 = Color3.new(242/255,251/255,255/255)
            text.TextWrapped = true
            wait(6)
            text.Text = "Journals like this will guide you through my nightmare."
            wait(4)
            text.Text = "This journal has valued content; the price of reading it..."
            wait(4.5)
            text.Text = "...Is to help me defeat the demon king."
            wait(3)
            text.Text = "You will travel through many worlds and stages, fighting many demons."
            wait(4.5)
            text.Text = "Be warned, this is a cruel nightmare. If you die,  you lose everything but your expirience."
            wait(6.2)
            text.Text = "If you wake up, you may even forget what you've learned about the demons, as well as the death penalty."
            wait(7)
            text.Text = "A teleporter  will appear on one of the hills behind you when you finish reading this."
            wait(5.5)
            text.Text = "Agh! I would write more, but a banshee has found me... Help m-...!"
            wait(4)
            text.Text = "*Scratches and spilled ink are on the paper*"
            wait(4)
            text.Text = "Go, now. I need your help. GO!"
            wait(2)
            text.Text = " "

            activated = false
        end
    end
end

exclm.Touched:connect(onPressed)



0
I'm going to use this script multiple times over, with a few minor additions but otherwise just changing the text. idkmanguy 30 — 10y
0
Oh alright, that seems like it should work then. Tempestatem 884 — 10y
Ad

Answer this question