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)
Anything that requires texts requires a string you cannot just do text1 that is invalid syntax unless text1 is a variable with a string
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.