Advertisement
EpicGamerSander1345

Untitled

Apr 17th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2.  
  3. local localPlayer = Players.LocalPlayer
  4.  
  5. -- Function to listen for chat messages and send "hi" back
  6. local function onPlayerChat(message)
  7. -- Check if the player typed "hi"
  8. if message:lower() == "hi" then
  9. -- Respond with "hi"
  10. game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer("hi", "All")
  11. end
  12. end
  13.  
  14. -- Connect the chat function to the Chatted event
  15. localPlayer.Chatted:Connect(onPlayerChat)
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement