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

What is wrong with MouseButton1Click?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago
script.Parent.TextButton.MouseButton1Click.Text = "121"

2 answers

Log in to vote
2
Answered by
dyler3 1510 Moderation Voter
9 years ago

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

0
Does not work. FiredDusk 1466 — 9y
0
It's set up perfectly fine. You must have given us the wrong path to the textbutton or something... dyler3 1510 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

it has to be

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

0
Sorry i cant explain right now, I can just be on for a bit... :/ UltraUnitMode 419 — 9y
0
You need to close the parentheses for the function. dyler3 1510 — 9y
0
Oh right sorry! UltraUnitMode 419 — 9y
0
:P dyler3 1510 — 9y
View all comments (2 more)
0
Dyler, I dont think the ":P" was necessary... UltraUnitMode 419 — 9y
0
:P dyler3 1510 — 9y

Answer this question