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

How would I make a "Click To Continue" GUI work?

Asked by 5 years ago
Edited 5 years ago

I wanted to make a script that when you click the button, it will constantly change your text to something new

I have the basis but I don't know how to make it keep changing

function onClick()
    tc.Text = text1
end
script.Parent.MouseButton1Click:Connect(onClick)
0
wait so what do you need to happen. can you give me a bit more detail tonyv537 95 — 5y
0
when you click, it will change the text that is in a box. Like a click to continue. It gives you text and when you click, it changes the text then if you click again it'll change the text, etc. SnakeInTheBoots 54 — 5y
0
what you could do is make more than one button and they are called Continue1, Continue2, etc. Then if you press Continue1, set the text to Text1, and make Continue1.Visible = false, and Continue2.Visible = true. Then when you press Continue2, set the text to text2, and make Continue.Visible = false and Continue3.Visible = true tonyv537 95 — 5y

2 answers

Log in to vote
0
Answered by
Cyrakohl 108
5 years ago

Anything that requires texts requires a string you cannot just do text1 that is invalid syntax unless text1 is a variable with a string

0
text1 is defined SnakeInTheBoots 54 — 5y
Ad
Log in to vote
0
Answered by
Rheines 661 Moderation Voter
5 years ago

This is how I'd do it if I'm not misinterpreting your question: when you click the button, it will show through all available texts and loop back to the beginning.

--The text location.
local tc = --location of the text you want to change

--Define all of the texts here
local text1 = "Text 1."
local text2 = "Text 2."
local text3 = "Text 3."

--Put all of the texts you defined on a table.
local texttable = {text1, text2, text3}

--The index of the table to show next.
local i = 1


function onclicked()
        --Change the text based on the current index of the table.
    tc.Text = texttable[i]
    --Loop back to the beginning if we reach the end.
    if i == #texttable then
        i = 1
    --Else show the next text for the next button press.
    else
        i = i + 1
    end
end

script.Parent.MouseButton1Click:Connect(onclicked)

Unless you want it to go to the end and not loop back, you can change it so that if i == #texttable then you make the button you push not visible.

Answer this question