MouseButton1Click miss to connect

I want when you click a button a TextBox will have the button text

This looks like a easy question but it dont works

i created a test that prints “click” when you click the button

function Click()

print("click")

end

script.Parent.MouseButton1Click:Connect(Click)

but i click the button and nothing happens

1 Like
script.Parent.MouseButton1Click:Connect(function()
print('click')
end)

i arleady tried these but still dont works

the image script are another test

@colochosgt3 Where is this script located?

@ExabyteDev His code and your code are the same.

1 Like

Is script.Parent a button?

local TextBox = script.Parent.TextBox -- or wherever the textbox is
function Click(Text)
    TextBox.Text = Text
end

script.Parent.MouseButton1Click:Connect(function()
    Click("Text to set")
end)

2020-12-26 19_37_06-Baseplate - Roblox Studio

these still dont works

the Connection is that glitches

So I tried your code at my game and it works so I think, that the problem is not in the code but at your output (Maybe you dont ticked “all messages”)
I hope that it was helpful.

Also the other buttons connection works

But this button connection dont works

Your LocalScript might be under the wrong Parent. Shouldn’t it be under SendMessage button?


no i want in the all button

TextBoxes don’t have a MouseButton1Click event, use a TextButton.

3 Likes

now i tried this script


script.Parent.MouseButton1Click:Connect(function()

script.Parent:Destroy()

end)

and this happens


These is not a TextBox its a TextButton

In a roblox game, you cant get an output, a output is only active in roblox studio, so you cant get a message like “print(”…“)”


but i am in roblox studio

You can; it is called the Developer Console.

Oh thanks, I´m kind of new and I didn´t know that so thx

umm i see a weird thing


when i put the button on another parent these works