Adding Editbox Text into a SendChatMessage?

Jul 10, 2008 at 6:44 PM

So here's the scenario. On the form I have an editbox and a button. Im trying to make it so that when I click the button, It says "Hello, (The Edit Box text). So if I typed "Bob" in the edit box. When I clicked the button, it would say "Hello, Bob".

I've tried all of these...

On Button Click
SendChatMessage("Hello"..Editbox1.text,"SAY","COMMON","SAY")

SendChatMessage("Hello"..Editbox1.text1,"SAY","COMMON","SAY")

SendChatMessage("Hello"..Editbox1.gettext(),"SAY","COMMON","SAY")

When I type "Bob" in the editbox, then click the button, nothing happens... The only trouble I'm having is that as soon as I try to put the Editbox text into the message, nothings comes up.

SendChatMessage("Hello Bob","SAY","COMMON","SAY")

Works fine. But Like I said, the previous listed lines don't.

I tried doing

str = Editbox1.text1 , str =  editbox1.text , and finally, editbox1.gettext()

Then put in

SendChatMessage("Hello "..str,"SAY","COMMON","SAY")

Still... Nothing.

Im Nub at Lua, but If anyone knows how to fix it, that would be great.

Thanks in advance.

Aug 23, 2008 at 12:25 PM
Try:

SendChatMessage("Hello"..Editbox1:GetText(),"SAY","COMMON","SAY")

You need a colon (:) to access properties and methods.
Also I think methods are case sensitive.
Feb 8, 2013 at 6:44 PM
Hey there; First message is for Magnamus; Thank you; that was just what I was looking for. I know the post is old but in case you ever see it I wanted to at least give a thanks for the help. Does anybody know how to make an editbox not autoinherit your cursor however?