I need to create a system where if the local player types a spell into the chat and then clicks on the player, it triggers a remote to carry out the entire function of the spell. The .Chatted
function only works server-side, so I urgently need to know an alternative. I’ve done a lot of research and haven’t found anything. Could someone please respond?
Actually I found a way by myself, I used TextChatService
and I’ll just leave the code here if anyone get the same problem someday in the future, so they’ll be able to find this solution:
local TextChatService = game:GetService("TextChatService")
local Player = game:GetService("Players").LocalPlayer
TextChatService.SendingMessage:Connect(function(ChatMessage)
if ChatMessage.TextSource.UserId == Player.UserId and ChatMessage.Text == ":test" then
print("WORKS")
end
end)
2 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.