Why is my remote function returning nil?
Hi everyone, quick question.
I'm basically sending out announcements in a game to all clients, but before doing so it individually matches the player's chat filtering settings.
I do this using a remote function to filter the chat in a server script, and then return the filtered text.
Here is my code?
Server Script:
01 | local repStore = game:GetService( "ReplicatedStorage" ) |
02 | local TextService = game:GetService( "TextService" ) |
04 | function repStore.filterMsg.OnServerInvoke(player,msg) |
05 | local success, errorMessage = pcall ( function () |
06 | return TextService:FilterStringAsync(msg, player.UserId):GetChatForUserAsync(player.UserId) |
09 | warn( "Error filtering text:" , msg, ":" , errorMessage) |
Local Script:
1 | repStore.sendAnnouncement.OnClientEvent:Connect( function (msg,timer) |
2 | msg = repStore.filterMsg:InvokeServer(msg) |
Any suggestions would be much appreciated.