So I have a Custom Chat GUI. What isn't working here is when I press enter after typing a message, it doesn't do anything. I've added a function and an if statement to detect if the Enter key was pressed. I've also added something so inside the if statement, it would execute a print command at the beginning and one after it to see if it was working, but nothing shows up in output.
local Player = game.Players.LocalPlayer
local Parent = script.Parent
local Mouse = Player:GetMouse()
local msgbar = Parent.msgbar
function EnterTriggerSend(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.Return and script.Parent.msgbar:IsFocused() then
wait()
print "Pre-Test Successful"
script.Parent.Parent.MsgChatFrame.chatbox6.Text = script.Parent.Parent.MsgChatFrame.chatbox5.Text
script.Parent.Parent.MsgChatFrame.chatbox5.Text = script.Parent.Parent.MsgChatFrame.chatbox4.Text
script.Parent.Parent.MsgChatFrame.chatbox4.Text = script.Parent.Parent.MsgChatFrame.chatbox3.Text
script.Parent.Parent.MsgChatFrame.chatbox3.Text = script.Parent.Parent.MsgChatFrame.chatbox2.Text
script.Parent.Parent.MsgChatFrame.chatbox2.Text = script.Parent.Parent.MsgChatFrame.chatbox1.Text
script.Parent.Parent.MsgChatFrame.chatbox6.Text = script.Parent.msgbar.Text
wait(0.1)
script.Parent.msgbar:ReleaseFocus()
script.Parent.msgbar.Text = "Tap the "/" button or click here to chat"
print "Post-Test Successful"
wait()
end
end
game:GetService("UserInputService").InputBegan:connect(EnterTriggerSend)

4 comments
trash
This only seems to edit chatbox6 with text from the msgbar. Is there a way to make it so when you also send message, chatbox6's text goes to chatbox5, chatbox5 to chatbox4, etc... ?
I shortened it by using the for loop. Try it out.
Thanks! I found out I mixed up the chatbox loop thing.