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

What is wrong with MouseButton1Click?

script.Parent.TextButton.MouseButton1Click.Text = "121"

2 answers

✓ Accepted answer

MouseButton1Click is a function. Therefore, you need to integrate it with the correct syntax. You should use it like this:

script.Parent.TextButton.MouseButton1Click:connect(function()
	--Code
end)

or

function Click()
	--Code
end

script.Parent.TextButton.MouseButton1Click:connect(Click)

So, in your case you're attempting to change the text of the TextButton. To do that, we'll use the function, and have it set up like this:

script.Parent.TextButton.MouseButton1Click:connect(function()
	script.Parent.TextButton.Text = "121"
end)

That's all there is to it! So now, this will fire the function, and then change the text to "121".


Anyways, if you have any further problems/questions, please leave a comment below, and I'll see what I can do. Hope I helped :P

####-Dyler3

2 comments

0

Does not work.

0

It's set up perfectly fine. You must have given us the wrong path to the textbutton or something...

it has to be

script.Parent.TextButton.MouseButton1Click:connect(function()
script.Parent.TextButton.Text  = "121"
end)

6 comments

0

Sorry i cant explain right now, I can just be on for a bit... :/

0

You need to close the parentheses for the function.

0

Oh right sorry!

0

:P

0

Dyler, I dont think the ":P" was necessary...

0

:P

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