Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

3 comments

0

wait so what do you need to happen. can you give me a bit more detail

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.

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

2 answers

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

1 comment

0

text1 is defined

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.