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

Why is the click event not firing?

Asked by 10 years ago
sendButton.MouseButton1Click:connect(function()
    print'clicked'
    NewM(script.Parent.Parent.Parent.Parent, messageBox.Text)
    messageBox.Text = 'Message'
end)

"clicked" is never printed, NewM is a valid function, and the message box's text is not changed. I haven't scripted in a while so I'm not sure about the MouseButton1Click event or anything.

1 answer

Log in to vote
0
Answered by 10 years ago

Sorry to say, but you messed up an event. MouseButton1Click is not a real event. Please consider this code to replace the above :)

sendButton.MouseButton1Down:connect(function ()
    print 'clicked'
    NewM(script.Parent.Parent.Parent.Parent, messageBox.Text)
    messageBox.Text = 'Message'
end)
0
Ah. I think I was using the click detector event. GoldenPhysics 474 — 10y
0
Well, actually, the 'MouseButton1Click' event is on the WIKI, and is a real event. :P And, Golden, 'MouseClick' is the event for a 'Click Detector' type instance, 'MouseButton1Click' fires when you click on a GUI type instance [TextButton, ImageButton]. TheeDeathCaster 2368 — 10y
Ad

Answer this question