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

How do you make a button to click that changes the text of a label?

Asked by 4 years ago

I don't know this, can you please help?

2 answers

Log in to vote
0
Answered by
Audiimo 105
4 years ago
Edited 4 years ago

Simple. Set up a function that activates from a click of a GUI button and then change the text of the label with .Text = string

function foo()
    local label = screengui.textlabel
    label.Text = (string)
end

button.MouseButton1Click:Connect(foo)

Obviously create the appropriate variables for the object. I have set it up so you have to write it down rather than copy and paste. It is rather simple and a quick Wiki search on GUIs and buttons could help explain in detail of what I did not cover because it is a lot.

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello NintendoMinecraftKid. Do you know how to make a UI? You need a ScreenGui put in StarterGui. If you know that, I can help you.

Just put a TextButton on this ScreenGui and put a LocalScript on this button and write that

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Text = 'Hello new text!!' -- This is a string.
end)

Check the developer page to learn more.

For more question, put below in commentary.

Answer this question