Skip to content

Instantly share code, notes, and snippets.

@BeboKhouja
Created January 24, 2023 03:32
Show Gist options
  • Save BeboKhouja/23e2a31e93a5d4b4029271415991bf22 to your computer and use it in GitHub Desktop.
Save BeboKhouja/23e2a31e93a5d4b4029271415991bf22 to your computer and use it in GitHub Desktop.
To send messages via a textbox.
local Chat = game:GetService('Chat')
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
script.Parent.FocusLost:Connect(function(enter) -- when the enter key is pressed
if enter then -- if the enter key is pressed
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(Chat:FilterStringAsync(script.Parent.Text, game:GetService('Players').LocalPlayer, game:GetService('Players').LocalPlayer), "All") -- Filters the string, sends it to chat.
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment