Im Trying To Make a Custom Chat And Trying To Use a RemoteFunction But It Keeps Giving Me An Error?
Hi There, So Basiclly I Want To Make A Custom Chat That Works And Everything Is In One Gui And So I Tried Using A RemoteFunction But I Keep Getting This Error bad argument #1 (string expected, got Object) (Line 6) Here Is The LocalScript:
01 | local input = script.Parent:WaitForChild( "ChatBox" ) |
03 | input.FocusLost:Connect( function (enterPressed) |
04 | if enterPressed = = true then |
05 | if string.len(input.Text) > 0 then |
06 | script.Parent.Parent.Parent.ReF:InvokeServer(input.Text) |
And Here Is The Normal Script:
1 | local send = game:GetService( "MessagingService" ) |
2 | local chatted = 'ChatConnected' |
5 | script.Parent.Parent.Parent.ReF.OnServerInvoke = function (input) |
6 | if input = = string.len(input) > 0 then |
7 | send:PublishAsync(chatted, '{' .. script.Parent.Parent.Parent.Parent.Parent.Name.. '} ' .. input) |
And Just Incase Here Is The Chat Text Script And GetFocus Script I Have Made:
ChatText (Script)
01 | local Get = game:GetService( "MessagingService" ) |
02 | local chatted = 'ChatConnected' |
04 | Get:SubscribeAsync(chatted, function (msg) |
05 | script.Parent.Chat 8. Text = script.Parent.Chat 7. Text |
06 | script.Parent.Chat 7. Text = script.Parent.Chat 6. Text |
07 | script.Parent.Chat 6. Text = script.Parent.Chat 5. Text |
08 | script.Parent.Chat 5. Text = script.Parent.Chat 4. Text |
09 | script.Parent.Chat 4. Text = script.Parent.Chat 3. Text |
10 | script.Parent.Chat 3. Text = script.Parent.Chat 2. Text |
11 | script.Parent.Chat 2. Text = script.Parent.Chat 1. Text |
12 | script.Parent.Chat 1. Text = msg.Data |
GetFocus (LocalScript)
01 | local uis = game:GetService( "UserInputService" ) |
02 | local chatBox = script.Parent:WaitForChild( "ChatBox" ) |
04 | uis.InputBegan:Connect( function (key, gameProcessed) |
05 | if key.KeyCode = = Enum.KeyCode.Slash and not gameProcessed then |
06 | chatBox:CaptureFocus() |
Please Help If You Can Since This Is My First Time Using A RemoteFunction. Thank You!