Text is a Property
Text is a property of a GuiObject, just like BackgroundColor3, Position, and Size.
Literal string
Therefore, to set it, just get the property of the gui guiObject.Text and set it equal to the string you want .
guiObject.Text = "the score is 5"
Non-string conversion to string
It is also possible to use non-strings if they will automatically convert to a string, such as numbers, or if manually set to a string using the tostring() method.
guiObject.Text = 5
Using variables
Variables can be used to store a string or non-string as described.
local score = 5
guiObject.Text = score
Concatenation and string manipulation
Additionally, string manipulation - frequently concatenation - can be used.
local score = 5
guiObject.Text = "The score is: " .. score
Or, with another variable:
local score = 5
local scorePrefix = "The score is: "
guiObject.Text = scorePrefix .. score
The Final Result
local frame = workspace.PartScoreboard.SurfaceGui.Frame
local score = 5
if frame.Pin1.BackgroundColor3 == color3.new(1, 0, 1) then
frame.Round1.Text = score
end
It is important to use conditional statements (ifs) correctly. All keywords are lowercase (if not If), double equals == is used to compare while singe equals= is used for assignment, and all ifs require then to close the conditional.
2 comments
Text is a property, like Backgroundcolor3. Therefore, gui.Text = textvar. Of course, textvar needs to be a string (or convertable into a string, such as a number).
You also need two == and lowercase if and a then.